-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: EXTENDED Persistence Context does not work with EpAT
PostPosted: Tue Nov 24, 2009 11:07 am 
Newbie

Joined: Sat Nov 21, 2009 9:42 am
Posts: 7
Hello,

I'm trying to port a JPA based, standalone application to Hibernate but I'm heavily struggling with the following problem:

The documentation for Hibernate EntityManager clearly states (see http://docs.jboss.org/hibernate/stable/ ... tions.html):
"The Hibernate Entity Manager may be disconnected from the underlying JDBC connection between two client calls and reconnected when a new client request occurs. This pattern is known as entitymanager-per-application-transaction and makes even merging unnecessary. An extend persistence context is responsible to collect and retain any modification (persist, merge, remove) made outside a transaction. The next client call made inside an active transaction (typically the last operation of a user conversation) will execute all queued modifications. Automatic versioning is used to isolate concurrent modifications."
Furthermore:
"All application managed entity manager and container managed persistence contexts defined as such are EXTENDED. This means that the persistence context type goes beyond the transaction life cycle. We should then understand what happens to operations made outside the scope of a transaction."

Obviously this doesn't work. When I try to modify an entity that was loaded earlier (outside a Transaction) a javax.persistence.PersistenceException("detached entity passed to persist: net.uniopt.domain.config.SettingSpec") is thrown.

Does Hibernate actually support an extended persistence context?
What's missing to get the correct behavior?
Do I have to use the entitymanager-per-request pattern with Hibernate, even if this contradicts the Java Persistence API?

Kind Regards,
Abbzug


Top
 Profile  
 
 Post subject: Re: EXTENDED Persistence Context does not work with EpAT
PostPosted: Mon Nov 30, 2009 12:42 pm 
Newbie

Joined: Sat Nov 21, 2009 9:42 am
Posts: 7
Hello,

The problem isn't the life-cycle of the persistence context itself, but of the entities it's containing.
The JPA specification clearly states that entities are detached on a rollback.
Of course I'm wondering what such an extended persistence context is good for when it doesn't contain any entities (because they all were detached at the last rollback). I'd appreciate any hints here.

So I have to apologize for my jump to conclusion and so I do.

- Abbzug


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.