My apologies - this does look like a bug. I need to do more testing on this case myself, but I think one of the big problems here is that we are trying to do conflict detection on our own in the hibernate assembler's updateItem method. Unless you are using a strict isolation level in your DB (repeatable read or serializable) this is not going to be transactionally correct anyway since the DB version can be modified after we have executed the query and before we do our update. We probably should not be getting the server version at all... hibernate has its own optimistic concurrency support that we should be using if it is enabled. That is probably the only way to get atomic conflict detection without resorting to using those particularly slow isolation levels.
That would potentially get rid of the conflicting version of the item in the transaction. The other thing I need to look into is the "merge" method in hibernate. Seems like we should probably be using that in the updateItem method? I'll be working on this next week so will send out any updates I can to the code. Jeff ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of parkerwhirlow Sent: Thursday, February 01, 2007 6:05 PM To: [email protected] Subject: [flexcoders] FDS/Hibernate Sample of updating hierarchical list of values 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 <http://tech.groups.yahoo.com/group/flexcoders/message/63308> any comments as to if anyone has done this successfully are greatly appreciated! thanks, PW

