Adam Hardy
Thu, 01 May 2008 03:50:05 -0700
Alexander Snaps on 01/05/08 11:30, wrote:
Using the JPA extended persistence context (not EJB), the clear() will eliminate any changes to the model before JPA comes to flush to the db. I assume it would work in an EJB container too.I'm not really sure I get the point your making here, but if you just do not want the EntityManager not flush to the database, shouldn't you rather just update the model outside of the transaction.
I mean persistent entities in the extended persistence context. Within or outside a transaction shouldn't affect the EntityManager, which will still flush updates to the database when closed.
Indeed calling the clear operation on the entity manager also results in all managed entities becoming detached. Beyond many operations on the current persistence context might result in the entity manager flushing state to the database. Yet having it behave differently because of updating managed entities outside of the tx also sometimes have the persistence context not behave as one would expect...
I'm afraid I can't quite follow you there. (Use of 'beyond'?) The clear operation is exactly what I want to do - with the result you mention. This is the start of a request (HTTP param conversion and calling setters on model properties), with a new EntityManager, so anything that goes wrong should cause everything to be cleared.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]