openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Vorburger" <mvorbur...@odyssey-group.com>
Subject RE: Is it possible to turn off AutoDetach?
Date Mon, 16 Nov 2009 17:29:03 GMT
> I tried to turn off auto detaching after commit or entity manager
closing by setting openjpa.AutoDetach property to "false" or to empty
value, but it seems not to work as I expected.

Funny to see this email today.. I coincidentally tried this last week as
well! I got it working on one open EM directly, with this (but read on):

  OpenJPAEntityManager oem = (OpenJPAEntityManager)em;
  System.out.println(oem.getAutoDetach());
  EnumSet<AutoDetachType> d = oem.getAutoDetach();
  d.clear();
  oem.setAutoDetach(d); 

but NOT, whatever I tried, with any config. on the
EntityManagerFactory...

> I know that this behavior is not exactly consistent with JPA standard.

Exactly; so after a good night's sleep we're not using above, and found
another solution to our "problem" instead.

PS, if anybody is interested: The problem why we also initially wanted
to turn off auto detaching for entity manager closing was that the
http://static.springsource.org/spring/docs/2.0.8/api/org/springframework
/orm/jpa/SharedEntityManagerCreator.html "will fall back to a newly
created EntityManager per operation" for a non-transactional read, so it
closes the EM in its Proxy, and thus stuff detaches before you get a
chance to do anything in between.  We are now going to do what we wanted
to do before Spring does its close() and implicit detach in a @PostLoad
instead.


-----Original Message-----
From: Adam Borkowski [mailto:borkos.devel@gmail.com] 
Sent: Monday, November 16, 2009 6:16 PM
To: users@openjpa.apache.org
Subject: Is it possible to turn off AutoDetach?


I tried to turn off auto detaching after commit or entity manager
closing by setting openjpa.AutoDetach property to "false" or to empty
value, but it seems not to work as I expected.

Is there any possibility to turn AutoDetach off?
I'm using OpenJPA 1.2.1 version.

I know that this behavior is not exactly consistent with JPA standard.

Thanks,
Adam Borkowski


--
View this message in context:
http://n2.nabble.com/Is-it-possible-to-turn-off-AutoDetach-tp4013250p401
3250.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Mime
View raw message