JPA获取java.sql.Connection执行(OUT)存储过程

JPA2.0

 

SessionImplementor session =entityManager.unwrap(SessionImplementor.class);
java.sql.Connection connection = session.connection();
CallableStatement cstmt = connection.prepareCall( "{ CALL SERVICE.PROC(?,?)}" );

 

记得加上@Transactional

 

测试过下面代码不行:

java.sql.Connection connection =entityManager.unwrap(java.sql.Connection.class);


  

你可能感兴趣的:(JPA2.0执行存储过程)