File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Removed entity becomes managed? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Removed entity becomes managed?" Watch "Removed entity becomes managed?" New topic
Author

Removed entity becomes managed?

no more user
Ranch Hand

Joined: Aug 07, 2002
Posts: 39
Hi,

Taking a look at JPA specification (3.2.1)

...persist operation, applied to an entity X are as follows:
...
If X is a removed entity, it becomes managed.
...

but when I try to run a simple hibernate example:
...
em.setFlushMode(FlushModeType.COMMIT);
Message m = em.find(Message.class, 32768L);
em.remove(m);
em.persist(m);
...

EntityNotFoundException: deleted entity passed to persist.

How can a removed entity becomes managed as a result of persist operation?? Am I missing something??

Please, any help?

Thanks.
[ December 10, 2006: Message edited by: Alexandre Lima ]
Lawrence Johnbosco
Greenhorn

Joined: Dec 03, 2006
Posts: 21
Hi,

It looks like, the provider you are using (Hibernate) is having some issues. When I tried with a similar example in Toplink ships with reference implementation of EJB Server ( Glassfish), it works for me.

Regards..Lawrence J
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Removed entity becomes managed?
 
Similar Threads
Persistence
ejb 3.0 - persist(...) description contradiction in API spec
Question about entity operations in the JPA Specification
detached entity vs. removed entity
Hibernate persistence not throwing EntityExistsException on persist