-->
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: many-to-one data not loaded
PostPosted: Tue Mar 30, 2004 9:21 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
Hi,
I have two tables, one table (LOOK_UP) has two columns -a key column and a description column. The second table(CL_INFO) has the key column from the first table as foreign-key.

LOOK_UP table
INSURED_UID number(10)
INSURED_NAME varchar2(50)

CL_INFO table
....
....
INSURED_UID number(10)
....
....


I've modelled this as a many-to-one relationship in the mapping file corresponding to the CL_INFO table, the mapping looks like this-
    <many-to-one name="insuredUid" column="INSURED_UID" class="LookUpRow"/>

When I execute a hibernate find query on the CL_INFO table from a stand-alone java program and try to retrieve the description column, it works fine and I'm able to get the description.
But when I execute the same query in a multi-tiered environment, the description is not fetched.

I have two questions-
-is the many-to-one mapping the right choice for this situation and
-why is it that no description is retrieved in a multi-tiered environment.

Thanks in advance.[/list]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 12:24 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
Hi,
Looking through the log file, I notice that sql query is generated only for the CL_INFO table, no query was generated for fetching from the LOOK_UP table.

What could this point to?

-Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 10:07 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Give more info (mapping etc)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 01, 2004 4:25 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
Located the problem.
I was saving the data elsewhere before the fetch. During the save an instance of the LookUp data is loaded with only the key (the description is not loaded). And that half loaded data is used in the fetch.

Fixed this by loading the data afresh from the database before the save.

-Thanks


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.