[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Unique entity classes mapped to same table
asmithJBoss
do-not-reply at jboss.com
Fri May 18 18:14:50 EDT 2007
Greetings,
I have the following scenario:
* Two distinct entity classes (A and B) are mapped to the same table
* Each entity class is mapped to distinct columns, except for two: the primary key, and another field that is updated by the database itself when the submit occurs, are both in each entity class
I have one method that does a find() on an instance of class A and updates it, and another method that does a find() and update on class B.
Within the same transaction context, I call the method that updates Class A with a given primary key, then I call the other method that updates Class B using the same primary key.
When there are updates to both entities I get a StaleObjectStateException - is there any way that I can update two entity classes mapped to the same row within the same transaction context?
I have tried a merge after updating the second bean, but that obviously doesn't work.
Thanks,
Andrew
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046948#4046948
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046948
More information about the jboss-user
mailing list