Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I am using hibernate 3.0
Following is my mapping file
[code]hibernate-mapping package="course.model">
<class name="Course" table="COURSE">
<id name="courseId"
column="COURSE_ID">
<generator class="assigned"/>
</id>
<property name="tinNbr"
column="TIN"
type="string"
update="false"
not-null="true"/>
<property name="pin"
type="string"
column="PIN"
update="false"/>
<property name="courseName"
type="string"
column="COURSE_NAME"
update="false"/>
<property name="courseType"
type="string"
column="COURSE_TYPE"
update="false"/>
<property name="courseAssin"
type="string"
column="CURSE_ASSIGN"
update="false"/>
</class>
</hibernate-mapping>[/code]
Following is my code I am trying to execute
[code]List courses = getHibernateTemplate().find("from Course e where e.tinNbr = ? and e.pinNumber = ?",
new Object[]{tin,pin});
for (Iterator it = courses.iterator(); it.hasNext(); ) {
Course cdrins = (Course)it.next();
String courseName = cdrins.getCourseName();
System.out.println("Course name is " + courseName);
}[/code]
My problem is .I am expected to get the different rows with different values of Course object.But when I displays
the result I am getting the first row three times.
System.out should display like
Expected :
Course name is English
Course name is Physics
Course name is Chemestry
But is displays like:
Course name is English
Course name is English
Course name is English
I will appreciate if somebody helps me out.I am been puzzling in this for a while.
Thanks,