Hibernate version:
3.1
Mapping documents:
<hibernate-mapping>
<class
entity-name="action.Student"
name="action.Student"
table="students"
dynamic-update="true"
dynamic-insert="true">
<id
name="identifier"
column="identifier"
type="long">
</id>
<property
name="name"
column="name"
type="string"/>
<property
name="class"
column="class"
type="string"/>
<property
name="age"
column="age"
type="int"/>
<property
name="city"
column="city"
type="string"/>
<property
name="dob"
column="dob"
type="date"/>
<property
name="doj"
column="doj"
type="date"/>
</class>
<hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
session.load(student,new Integer(10));
The generated SQL (show_sql=true):
select stu.identifier,stu.name,stu.class_level,stu.age,stu.city.stu.dob,stu.doj from students stu where age >10;
Question: How to project (select) required column alone, for example I want to select only identifier,name and dob from student entity/table.
Is there anythig can we do in mapping document?
Note: We can use HQL to project particular columns in select clause but I can't use HQL in my project.
Thanks in advance.
|