-->
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: controll if associations are updated if an Entity is changed
PostPosted: Thu Jun 14, 2007 4:17 pm 
Newbie

Joined: Sat Jun 09, 2007 11:45 am
Posts: 6
Hello!

One can statically determine if a save in one entity leads to a save in an associated entitie (or entities, for many-case) by means of the cascade-attribute in the mapping or by annotations.

But is it also possible to determine the desired behaviour for the following cases?

1. For value-objects, then of course dynamically, other would make no sense.
2. For associations, also dynamically? So for example if I have a one-to-many relationship owned by the one side in order to manage the order of entries.

My question has the following background.

I think about to make different DAO-Methods that accept the same Classtype as parameter but save or update different parts of an Entity.

The desired behaviour would optimize the performance especially when the associated objects are not in the hibernate-cache, as it might probably the case in web applications and a session-per-request style.

I´ve just found out, that for associations ONE-TO-MANY OR MANY-TO-MANY Hibernate itsself determines if the Collection of associated Entities has changed. This
can be achieved because Hibernate has it´s own Collection implementation and can determine if the Collection has changed since it has been initialized.
So the performance arguement is not given anymore.

But still I want to have my "complex" DAO-Layer, because I want to be able to change to an other persistence mechanism that is not that intelligent.

But the problem is, if I write a DAO-Method that shall only save parts of the Entity and the associations it manages, I have to be sure that nothing else
is saved, also if something has changed.

I hope somebody understands my question. :-)

Thank you very much in advance.

Jörg


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.