哪個Spring-Data-JPA版本和您使用哪個PersistenceProvider? 你能指點我一個簡化的示例應用程序,重現問題?
正如評論中所說,我可以重現你的問題。 程序執行需要一個TX,它不存在或周圍的TX永遠不會被提交。
你可以嘗試添加程序法@Transactional
角色實體:
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedStoredProcedureQueries;
import javax.persistence.NamedStoredProcedureQuery;
import javax.persistence.ParameterMode;
import javax.persistence.StoredProcedureParameter;
/**
* Oracle PL/SQL
*
* <pre>
* CREATE or replace PROCEDURE update_roles (pattern_i IN varchar) AS
* BEGIN
* DBMS_OUTPUT.put_line('update_roles Received pattern: ' || pattern_i);
* END;
*/
*
* <pre>
*/
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(name = "Role.updateRoles"
, procedureName = "update_roles"
, parameters = {
@StoredProcedureParameter(name = "pattern"
, mode = ParameterMode.IN
, type = String.class) })
})
@Entity
public class Role {
@Id @GeneratedValue//
private Long id;
private String name;
...
的RoleRepository:
import java.io.Serializable;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.query.Procedure;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
interface RoleRepository extends CrudRepository<Role, Serializable> {
@Procedure
@Transactional
void updateRoles(@Param("pattern") String pattern);
}
我創建https://jira.spring.io/browse/DATAJPA-663來調查這一點。 – 2015-01-21 08:20:36