Hi all,

I have been tearing my hair out trying to get FDS/Hibernate to update
a hierarchical list of values. Even the simplest of collection
mappings in Hibernate cause various exceptions when trying to update.

Before I post my details, does anyone have any examples of this that
work? Has anyone ever even gotten this to work?

I have two objects mapped in Hibernate:

- Family
----Person

where a Family has a Set of Person "familyMembers".

My FDS destination is to Family, and I am trying to update a family
member (just the name) through this destination.

First, I was getting Hibernate NonUniqueObjectException, which I
finally tracked down to having my hibernate collection mapping set to
lazy=false This caused all of the family member Person objects to be
loaded into the PersistenceContext when the HibernateAssembler loaded
the "serverVersion" of the Family. 

Then, once I set lazy=true on the collection mapping, I was getting an
exception that "A collection with cascade="all-delete-orphan" was no
longer referenced by the owning entity instance"... since it is
assigning a whole new collection to the familyMembers property one
becomes unreferenced, and the other referenced. Sooo I can't use
delete orphan to delete the family members when the family is
deleted... OK. So then I make cascade="all".

Now I'm getting "ORA-01407: cannot update
("SCHEMA"."T_PERSON"."FAMILYID") to NULL"... I'm guessing that it's
processing the dereferenced collection first (trying to detatch any
Person's from the family before they're re-attached by the new
collection. I can't believe this is so difficult...

For more info on my setup and test case, please see my original post:
http://tech.groups.yahoo.com/group/flexcoders/message/63308

any comments as to if anyone has done this successfully are greatly
appreciated!

thanks,
PW


Reply via email to