Hi,
In our application we have to call procedures,can any one suggest me how to
call procedure in open JPA.
I am getting the connection and doing this method is right or wrong no
ideaa plese find the below code.
public static String retrieveCustomerRelation(int relation, EntityManager
em) throws Exception {
String command = "{? = call relation(?)}";
Broker broker = JPAFacadeHelper.toBroker(em);
Connection connection = (Connection)broker.getConnection();
String str = "";
try{
CallableStatement cstmt = connection.prepareCall(command);
cstmt.registerOutParameter(1,Types.VARCHAR);
cstmt.setInt(2, relation);
cstmt.execute();
str = cstmt.getString(1);
cstmt.close();
}catch (Exception e){
e.printStackTrace();
}finally{
connection.close();
}
return str;
}
--
View this message in context:
http://openjpa.208410.n2.nabble.com/How-To-Call-Procedure-in-OpenJPA-tp5035821p5035821.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.