-->
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.  [ 2 posts ] 
Author Message
 Post subject: hbm only for the result of a query
PostPosted: Wed Aug 31, 2005 8:06 am 
Newbie

Joined: Wed Aug 31, 2005 7:51 am
Posts: 3
Hi,

I have an query for a report and i would like to know if it is possible create an hbm file for represent de result.

If not, how could i do? because de query have same properties that are not present on tables... like sum()...

Thank you


Top
 Profile  
 
 Post subject: Re: hbm only for the result of a query
PostPosted: Wed Aug 31, 2005 8:48 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
You can create the mapping and leave the table name off

<class name="MyObject" mutable="false">
...
</class>

Create a non-default constructor which takes the values you want to return from the query and execute a query something like this.

Code:
select new xxx.yyy.MyObject(a.xx, a.blah, ...) from...

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.