|
Re: Stored Procedure call - Autocommit behavior [message #523993 is a reply to message #523845] |
Tue, 30 March 2010 08:34 |
Thomas Haskes Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Am 29.03.2010 17:19, schrieb Thomas Haskes:
Hi again,
I think I need to give some more information about this. My use case is
that I have a three tier application where standard jpa is use mostly,
but I need to reuse some database code that runs in stored procedures,
and I need every logged in user to use his own EM, because the stored
procedures track the user account that called it. To achive that, I
switched off the connection pool and used exclusive connections. Now
every user that logs in has his own em. This works so far. Now I want to
be able to call some stored procedures within the exact same database
session the exclusive em uses, and I down't want this session to
commited after a SP was called, because that user may decide to roll
back all changes he made (including the ones using the "normal" jpa EM)
later.
I read that starting a transaction should turn the autocommit off, I
tried it, but it didnt work for me. No matter what I do, after calling
the procedure i can see the changed data in the database. I think this
might have to do with the way I am acquiring the session in the code
below - but I dont know a better way. It seems that getActiveSession
does not return the exact same session that the em is using. Anyway, I'm
stuck. I tried the other methods the jpaEm-object offer me to get a
session, but non of them seem right.
Any help is appreciated, thanks
Tom
> JpaEntityManager jpaEm = JpaHelper.getEntityManager(tm.getEntityManager());
> Session session = jpaEm.getActiveSession();
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03851 seconds