[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] detached object changes aren't completely merged?

Hi Tom,

I don't get it... What do you mean with:

Tom Ware wrote
> (You have not maintained identity on the client side.)

???

I added an equals() and hashCode() implementation on child and parent...
And I'm correcting the collection on the client:
        Collection<Child> children = mom.getChilds();
        if (children == null) {
            children = new LinkedList<Child>();
        }
        children.clear();
        children.add(child);
        mom.setChilds(children);


Alright I changed my 'save' method on the server, so that I always merge the
parent before the child. (But for my real product this can't be the
solution, because I'm dealing with a lot of entities with different
bi-directional relations.)

        transaction.begin();
        mom = em.merge(mom);
        child = em.merge(child);
until here everything seams fine, but after the commit:
        transaction.commit(); 
the child has the OLD name again!?!?

Complete updated sources:  src.zip
<http://eclipse.1072660.n5.nabble.com/file/n156232/src.zip>  

I'm glad about any working solution.
Thanks.

-Hilmar



--
View this message in context: http://eclipse.1072660.n5.nabble.com/detached-object-changes-aren-t-completely-merged-tp156056p156232.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.