persistence@glassfish.java.net

Re: merge abstract entity

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 31 Jul 2007 13:58:07 -0700

Hi Florent,

Do you mean the previous version of glassfish as v1 or some older build?
Remove-persist of the same PK in a single transaction should work, so please
file a bug if you have a reproduceable test case.

BTW, did you try your original approach with the latest build?

thanks,
-marina

Florent GARIN wrote:
> 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
>