-->
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.  [ 4 posts ] 
Author Message
 Post subject: @ManyToOne + lazy + referencedColumnName doesn't lazy
PostPosted: Sat Apr 28, 2012 7:47 pm 
Newbie

Joined: Sun Jan 24, 2010 4:20 pm
Posts: 13
First; Sorry for the cranky subject but this forum doesn't allow enough chars in subject to write usefull ones...

Anyway; In Hibernate-4.1.2 (an probably other versions) I noticed that using "referencedColumnName" on a @JoinColumn in a @ManyToOne-association makes the lazy-loaded entity fore a load.

Take this mapping:

Code:
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "created_by", referencedColumnName = "natural_id")
private Person person = null

When mapping it using Person's PK (and hence skipping the referencedColumnName-attribute from the @JoinColumn-annotation) Hibernate correctly doesn't load the association because it's declared LAZY, but mapping it using an alternate key (here "natural_id") makes Hibernate trigger a load of the lazy-loaded association.

Any way around this?

Thanks.

--
Andreas


Top
 Profile  
 
 Post subject: Re: @ManyToOne + lazy + referencedColumnName doesn't lazy
PostPosted: Tue Jun 12, 2012 11:08 pm 
Newbie

Joined: Tue Jun 12, 2012 11:00 pm
Posts: 1
I have the same problem. Any solution now?


Top
 Profile  
 
 Post subject: Re: @ManyToOne + lazy + referencedColumnName doesn't lazy
PostPosted: Wed Jun 13, 2012 4:41 am 
Newbie

Joined: Tue Jun 21, 2011 5:33 am
Posts: 7
I have same/similar problem posted:
@manytoone not lazy loaded - always additional select(s)
but no solution by now.
I'd post any advance.

Thanks, Daniel


Top
 Profile  
 
 Post subject: Re: @ManyToOne + lazy + referencedColumnName doesn't lazy
PostPosted: Fri Sep 07, 2012 5:22 pm 
Newbie

Joined: Sun Jan 24, 2010 4:20 pm
Posts: 13
I reported this issue here: https://hibernate.onjira.com/browse/HHH-7526

Feel free to vote for it.

Let's hope someone will address this soon as it makes working with legacy-databases a pain.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.