-->
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.  [ 2 posts ] 
Author Message
 Post subject: ManyToOne lazy fetching on non primary key associations
PostPosted: Mon Oct 16, 2006 1:15 pm 
Beginner
Beginner

Joined: Tue Oct 10, 2006 3:23 am
Posts: 33
Hi,
Because I have a legacy database I was trying to make an associations between 2 classses whithout using the Pk on the linked class, something like that:

Code:
class Foo

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="BAR_TYPE_NAME",referencedColumnName="TYPE_NAME",unique=true)
public Bar getBar()

and
Class Bar
...
@Column(name = "TYPE_NAME",unique=true)
public String getTypeName()...



This works however the lazy option has no effect and bar is always fetched in a secondary select.
Is there a way to lazy fetch Bar in this case and to get it cached, given the fact that typeName is unique?


Thanks in advance,
Moor


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 16, 2006 1:55 pm 
Beginner
Beginner

Joined: Tue Oct 10, 2006 3:23 am
Posts: 33
Sorry my mistake, wrong Forum


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.