-->
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: Do this query will do lazy loading for table1
PostPosted: Tue Nov 27, 2007 8:13 am 
Newbie

Joined: Tue Nov 27, 2007 7:38 am
Posts: 1
Location: United Kingdom
Hibernate version: 3.0
Name and version of the database you are using: SQL Server 2000

Hi everyone!
I have two tables in my database table1 and table2
table1 have one to many relation with table2 [table1 (1 --> n) table2]

table1.field1 is referred as foreign key in table2 as table2.field2. table2.field1 is primary key of table2.

The code is running fine with the following query:
Code:
from table2 as tab2 where tab2.field1='blahblah' and tab2.field2=’blah'


But I don't want to load all the fields of table2.
So thats why I'm trying to provide the following query:
Code:
select tab2.field1, tab2.field2, tab2.field3 from table2 as tab2 where tab2.field1='blahblah' and tab2.field2=’blah’


Problems:
1 - Do this query will do lazy loading for table1 ?
2 - I'm unable to cast the class got from list e.g.
Code:
MyClass2 obj_MyClass = (MyClass2)list_data.get(0);

Note: MyClass2 is persistence class of table2

Exception:
It is giving me class cast exception
Code:
java.lang.ClassCastException: [Ljava.lang.Object;

_________________
br,

KS


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.