| Stored Procedure call - Autocommit behavior [message #523845] |
Mon, 29 March 2010 06:28  |
Thomas Haskes Messages: 142 Registered: July 2009 |
Senior Member |
|
|
Hi all,
I'm calling a stored procedure that changes some data in the database
using the following code, and i noticed that the procedure call the way
I use it does a commit after being executed. The problem is that I dont
want the session to be autocommitted at all. How can I achieve that?
Here is the code I use:
JpaEntityManager jpaEm = JpaHelper.getEntityManager(tm.getEntityManager());
Session session = jpaEm.getActiveSession();
StoredProcedureCall procedureCall = new StoredProcedureCall();
procedureCall.addNamedArgument("Blabla", "Blabla", String.class);
DataReadQuery query = new DataReadQuery();
query.setCall(procedureCall);
ArrayList<Object> args = new ArrayList<Object();
query.addArgument("Blabla");
args.add("SomeValue");
session.executeQuery(query, args);
Besides: Is it possible to have EL decide whether data is manipulated in
the procedure and, if so, throw an Exception when outside of a transaction?
Thanks in advance
Tom
|
|
|