-->
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: Hibernate - Unnnecessary Cascades
PostPosted: Tue May 07, 2013 8:31 pm 
Newbie

Joined: Tue May 07, 2013 7:25 pm
Posts: 1
Hello All,

I have a object graph being used in multiple process flows. The root object is annotated to cascade to multiple entities/collections on a save/update.

We are noticing that our application is issuing a lot more updates than it actually should. So, i had some basic questions to expedite my own debugging (while i read the documentation)

1. How does hibernate decide when to cascade? My understanding is that it does that when it deems the objects 'dirty' and it determines that by checking the current snapshot against the one in the persistent cache. it does not rely on equals/hashcode to make this determination. But what would hibernate do if the entity is detached and a 'select before update' is not configured on the entity? Would it always cascade? i think it would but i am seeking a confirmation.


2. How does hibernate differentiate between a new entity vs a detached entity since both do not exist in the current persistent context? i am talking about a scenario where i give a 'new' entity an identifier (primary key). How would hibernate know that it isn't detached but new?


Any pointers/references will help...


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.