-->
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.  [ 2 posts ] 
Author Message
 Post subject: Criteria and Alias
PostPosted: Thu Oct 23, 2008 7:51 am 
Newbie

Joined: Thu Oct 23, 2008 7:44 am
Posts: 1
iam using Hibernate version:3.3

session.createCriteria(School.class)
.createAlias("Student_ORM", "Student")

but i just retrieve property of School object ,i can't retrieve property Student_ORM

Please help me retrieve property of Student_ORM with the help of Criteria :D

thanks alots :D


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2008 11:58 am 
Newbie

Joined: Tue Oct 07, 2008 12:17 pm
Posts: 13
I guess you have one-to-many relation from SCHOOL to STUDENT_ORM table.
If that is the case you might be declared a list in the School.java as follows:

<list name="students" inverse="true">
<key column="school_ID" />
<one-to-many class="com.hibernate.Student" />
</list>

Even with your criteria query,
session.createCriteria(School.class)
.createAlias("Student_ORM", "Student")

you can get the list of students.
List<Student> studentList = school.getStudents();


If this not resolved your problem, can you please give the exact requirement with these 2 tables?

------------------------
Velu


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.