[jboss-user] [EJB/JBoss] - Semantics merge and cascade.merge (cascade.all)

oortdg do-not-reply at jboss.com
Mon Mar 9 17:01:58 EDT 2009


I've a question of the semantics of merge and the casdetype.merge.  I thought that merge means: find a object with the same id ( and type ) in the database when it isn't there add this object (and all it childs with cascadetype.merge) and return this new object.

When the object with the same id is in the database than all the changes from the incoming object must merge into the database and when there is a cascadetype.merge that relation must be merged into the database too.

So when I have a A and a one-to-many relation with B the changes on the B's must be merged into the data base too. When this is a delete on a B than this B must be deleted too. (Remove on A will delete all B's too when there is a cascadetype.delete)

But on jboss 5.01.ga (or others ) A and its simple properties are merged  the Updates on the B's and inserts new B are also merged but a delete B will disconnect the B with the A but this delete will not affect the row in the Table B it stays in the database and in the end it pollute the database with row's that must be deleted by hand.

The big question is have I understood the functionality of merge well or not, and wat is is the right  functionality of merge and cascadetype.merge

I've used a mysql 5.0 database a remote client and jboss 5.01.ga. 


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216378#4216378

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216378



More information about the jboss-user mailing list