-->
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: Mapping using hibernate mapping file for selected Fileds
PostPosted: Mon Jun 08, 2015 11:35 pm 
Newbie

Joined: Thu Feb 21, 2008 6:19 am
Posts: 7
Hi All,

I have a native sql query which is returning few fields out of many columns in table.

I am writing that named sql query in hbm file and doing aliasing like this. I have table euivalent pojo as well. But when i am using hbm file its is not returnig
employee object with specific selected fileds. When i use in java code using .setResultTransformer(Transformers.aliasToBean()).It is working

Please help a way to do in hibernate mapping file instead of java code.



<sql-query name="getStudents">
<return alias="XNI" class="com.Employee"/>
<return-scalar column="name" type="string"/>
<return-scalar column="className" type="string"/>
select NAME,CLASS_NAME from EMPLOYEE_DETAILS
</sql-query>


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.