-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MAP persistency issue
PostPosted: Thu Jan 07, 2010 6:17 pm 
Newbie

Joined: Thu Jan 07, 2010 5:04 pm
Posts: 1
Hibernate version: 3.3.2

Our project has a parent-child class relationship defined with this mapping:

Code:
    <map name="children"
         lazy="false"
         batch-size="30"
         inverse="true"
         cascade="save-update"
         order-by="unique_key2 asc">
        <key column="parent_primary_key" />
        <map-key type="integer" formula="unique_key2" />
        <one-to-many class="child_class" />
    </map>


The child has a PK object consisting of the 'parent_primary_key' and 'unique_key2'.
There is an initial load of the parent and several children within the same session. The objects are eventually flushed and the session is closed.

Then, a new session is created and the following actions occur:

    1. Add new child record to parent
    2. Merge parent in session
    3. Call session saveOrUpdate with parent

    .....perform additional work on parent....

    4. Merge parent in session ( _hibernateSession.merge(obj) )
    5. Call session saveOrUpdate with parent
    6. Flush the hibernate session
    7. Explicitly evict the parent and child objects from the session

Throughout the process, the parent's child records show the new object, but the child object is still not persisted.
The child Java objects do not have a backref to the parent.

In this scenario, there is no concurrent session, so most of the solutions we've seen don't seem to apply.
The merge() step was added to help get us past the common NonUniqueObjectException.

What might we be missing?

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.