-->
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: Projection for select clause
PostPosted: Wed Feb 20, 2008 5:34 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
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.


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.