users@glassfish.java.net

Re: Two entity classes mapped to same table

From: <glassfish_at_javadesktop.org>
Date: Fri, 18 May 2007 15:29:16 PDT

Hi Andrew,

I don't know if the persistence provider (not the container) tries to help you, but theoretically speaking it should treat 2 instances of different classes completely independent. If on the other hand, you marked a field or a property as a @Version, the provider will check that the version of each entity didn't change in the course of the transaction, and will throw an exception if it did.

Now about the merge: it's not possible to merge values from 2 different entities. You can call em.refresh to refresh the version value, but then you'll need to reapply the changes to the instance again.

Regards,
-marina
[Message sent by forum member 'mvatkina' (mvatkina)]

http://forums.java.net/jive/thread.jspa?messageID=217930