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 table2Exception:It is giving me class cast exception
Code:
java.lang.ClassCastException: [Ljava.lang.Object;