-->
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: Lazy load not working for ManyToOne on non key field
PostPosted: Wed Jul 11, 2012 9:07 am 
Newbie

Joined: Wed Jul 11, 2012 8:53 am
Posts: 1
Hi,

I have two entities A and B with following details:

In A.java: A is associated with B through B_CODE.
@ManyToOne(targetEntity = B.class, optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "B_CODE", referencedColumnName = "B_CODE", nullable = false)
private B b;

In B.java: B_CODE is not a key column in B. B_ID is Primary key.
@Id
@Column(name = "B_ID")
private Long id;

@Column(name = "B_CODE", nullable = false)
private String code;

In spite of defining the association in A as lazy, it is always loaded whenever A is queried.
Is this because the association is with a non key column of B?


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.