persistence@glassfish.java.net

merge abstract entity

From: Florent GARIN <florent.garin_at_docdoku.com>
Date: Wed, 25 Jul 2007 10:15:20 +0200

 I have an object with a OneToMany association (actually it's a
composition in the UML sense) that is linked to an abstract entity
object. Thus, the collection association can contain any of the two
concret subtypes of the abstract entity class. The primary key of the
abstract entity is the index in the list concatenated with the primary
key of the parent object.
 The problem occurs when I want to cascade update this object. When
using the merge operation on the abstract entity I've got an error if
the subtype has changed.
 I don't know what exactly the spec is saying perhaps this could be
considered as a bug?
 So, because I cannot merge such object, I decided to remove the
whole object graph and recreate it.
 That solution was working on previous version of glassfish (and so
of TopLink) but now I cannot persist an object with the same PK than
one that was removed in the same transaction.
 So, what can I do, except from splitting the remove and the persist
operation in two transactions ?
 Thanks.
 Florent GARIN