-->
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: Why Does Hibernate Select Each Child Collection After Insert
PostPosted: Mon May 23, 2011 2:22 pm 
Beginner
Beginner

Joined: Mon Jul 28, 2008 4:36 pm
Posts: 24
I have a parent object with a lot of different child collections:
Code:
parent
    Set<childType1> ...
    Set<childType2> ...
    Set<childType3> ...
etc.

When I turn org.hibernate.SQL logging to DEBUG and issue the following statements:
Code:
hS.save(oldCo);
hS.getTransaction().commit();
logger.info("all done");

I expect to see the following in the logs and I do:
Code:
DEBUG org.hibernate.SQL::log(401):
    insert into db.parent (...) values (...)


But then I immediately see this:
Code:
    select ... from
        db.childType1 childType10_
    where
        childType10_.parent_id=?

    select ... from
        db.childType2 childType20_
    where
        childType20_.parent_id=?
etc.
INFO myapp.Test::execute(391): all done


Why does it select all the child collections after doing an insert? I thought they were all initialized with Hibernate proxy objects?


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.