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: How to avoid initializing proxy objects in Set
PostPosted: Tue Mar 18, 2008 3:24 am 
Newbie

Joined: Tue Dec 12, 2006 7:16 pm
Posts: 2
In section 19.1.3 of the v3 documentation it says:

Quote:
Certain operations do not require proxy initialization
* equals(), if the persistent class does not override equals()
* hashCode(), if the persistent class does not override hashCode()
* The identifier getter method

Hibernate will detect persistent classes that override equals() or hashCode().


I can't find any documentation explaining why the proxy would need to be initialized if the persistent class overrides equals() or hashCode(). Can anyone send me a reference? I can't understand why that is a requirement. My equals() and hashCode() methods only call the primary key getter method.

My problem is this:

I have a main class A that contains a Set of another class B. Because B is used in a set, it has to define its own equals() and hashCode() methods. Because of the limitation above, I can't perform operations on a Set of B proxy objects without them being initialized, even though the only information I need from them is the primary key of B.

Can anyone tell me how to fix this? At present hibernate is loading all of the details of B unnecessarily.

I'm using Hibernate 3.2.5

Thanks
Martin


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.