Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1
<hibernate-mapping>
<class name="Conference.Paper" table="paper">
<id name="id" column="id" type="java.lang.Integer" unsaved-value="any">
<generator class="assigned"/>
</id>
<property name="title" column="title" type="string" not-null="true"/>
<property name="filetype" column="filetype" type="string" not-null="false"/>
<property name="abStract" column="abStract" type="string" not-null="false"/>
<property name="userid" column="userid" type="java.lang.Integer" not-null="true"/>
</class>
</hibernate-mapping>
StringBuffer s=new StringBuffer("select c from Paper as c where c.userid='");
s.append(userid);
s.append("'");
beginTransaction();
Query query=session.createQuery(s.toString());
Iterator it=query.iterate();
while(it!=null && it.hasNext())
{
Paper paper=(Paper)it.next();
System.out.println("Paperid="+paper.getId());
}
return it;
***********************************
the problem is weird: I can get all properties except id. It just looks like the getId() method always returns 0.Why??
Thanks.