Thursday, 1 July 2010

EntityManager em = JpaUtil.getEntityManager(); String sql = "{call REINSPARTY.test(?,? )}"; Query query = em.createNativeQuery(sql, ""); Object v = ne

JPA call oracle stored procedure.

EntityManager em = JpaUtil.getEntityManager();
String sql = "{call test(?,? )}";
Query query = em.createNativeQuery(sql, "");
Object v = new String();
query.setParameter(1,v);
query.setParameter(2,ids);
String msg = "msg:";
msg = msg + v; // v is empty
Log.debug(this, msg);


procedure test(rt OUT VARCHAR2, partyIds IN VARCHAR2) is
begin
rt := 'test test';
end;

No comments: