-->
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.  [ 3 posts ] 
Author Message
 Post subject: 2 Problems with many-to-one property
PostPosted: Fri Feb 25, 2005 5:05 am 
Newbie

Joined: Thu Sep 30, 2004 6:00 am
Posts: 13
Hello,

I have an entity that owns several many-to-one properties.

When I do a xxxDAO.load(id) on it, it seems to do a select for all target tables.
I would like to load foreign entities just when I need to do.
But I can't find any "lazy=true" option in the many-to-one tag...

Secondly, if I declare a many-to-one property in my hbm, initialization fails : "repeated columns".
I have to remove the FK_id simple property in my hbm to fix this.
But I really need sometimes to get just the FK_id and not the entire foreign entity.

Did I misunderstand something about the use of "many-to-one" ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 25, 2005 8:46 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Your many-to-one entity should then be a proxy.
See class proxy or class lazy in entities hbm.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 25, 2005 3:29 pm 
Newbie

Joined: Thu Sep 30, 2004 6:00 am
Posts: 13
Thank you!

I added "lazy=true" in the class tag of the parent entity and lazy initialization for many-to-one properties works fine now!

But it didn't fix my second problem.

Log says something like "repeated column, you should add insert=false ; update=false".

I added that in the simple property "FK_id" and initialization doesn't fail anymore.

I'm quite happy but I'm not completely satisfied because as I don't have a lot of experience in Hibernate I can't guess what will be the consequences of "insert=false" and "update=false" in my program.

Does it affect parent entity's saveOrUpdate in a way?

Thanks again for your clue


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

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.