-->
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: Lazy many-to-one association / referencedColumnName
PostPosted: Mon Oct 22, 2007 9:43 am 
Newbie

Joined: Thu Jan 13, 2005 4:04 am
Posts: 12
Location: Estonia
Hi,

I have a problem to force Hib. (3.2.5.ga) to load some "specific" many-to-one associations by lazy strategy.

I have table X:

CREATE X (
ID VARCHAR2(10) NOT NULL, -- PK
CODE NUMBER(10) ,
CODE_REF1 NUMBER(10),
CODE_REF2 NUMBER(10)
)
;

where x.CODE_REF1 and x.CODE_REF2 are "inner" foreign key references (references to records of the same table, I will not include FK constraints here).

Problematic mapping sections are defined as smth. like that:

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "CODE_REF1", referencedColumnName = "CODE", nullable = true, insertable = false, updatable = false)

public X getXByRef1() {
return xByRef1;
}


@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "CODE_REF2", referencedColumnName = "CODE", nullable = true, insertable = false, updatable = false)

public X getXByRef2() {
return xByRef2;
}


When I load "parent" entity X by id, hibernate always cause automatically initialize these two child associations (and then their inner references as well and so on as deep as references exists) of the given entity.

When I remove 'referencedColumnName = "CODE"' from configuration (link entities through PK field "ID") then these properties seems to have proxy objects assigned (as I expect) and lazy constructions work fine.

Any comments, why does not it succeed with "referencedColumnName" parameter in configuration?

Thnks,
Ilhan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 22, 2007 5:22 pm 
Newbie

Joined: Sun May 06, 2007 9:42 am
Posts: 7
just a thought, not sure it will help,

try using @LazyToOne(LazyToOneOption.NO_PROXY) instead of the fetch configuration you currently have.

See if that helps.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 2:43 am 
Newbie

Joined: Thu Jan 13, 2005 4:04 am
Posts: 12
Location: Estonia
No, it does not... I also found similar description of this behaviour from Hibernate JIRA issue list:

http://opensource.atlassian.com/project ... e/HHH-2766


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.