-->
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: help needed in using Criteria for fetching data
PostPosted: Tue Jul 31, 2012 2:44 am 
Newbie

Joined: Tue Jul 31, 2012 2:18 am
Posts: 1
hi all.
i am new to hibernate.I am using criteria for fetching data from derby DB and one more thing i am using Annotation.
Now my problem is i have created a table named SCHOOL from two classes Named School.java and SchoolDetail.java.
in School.java class there are 3 fields schoolId(generated value),schoolName,and instance of SchoolDetail.
and there are 3 fields in SchoolDetail.java schoolAddress,isPrivate,studentCount.
now i am using the following code to fetch data.

Criteria crit = session.createCriteria(School.class);
crit.add(Restrictions.eq("studentCount", 1500));
List<School> schoolList = crit.list();

its getting an exception because studentCount field belongs to SchoolDetail.java .
can anyone please help in this case....

Thanx in advance..


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.