-->
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: unmapped classes as sql query result
PostPosted: Wed Sep 23, 2009 11:01 am 
Newbie

Joined: Wed Sep 23, 2009 10:48 am
Posts: 1
Hi,

Is there a way to use unmapped classes as return type of named sql querys?

e.g.

Code:
<sql-query
      name="aQuery">
      <return
         alias="aClass"
         class="org.company.AClass" />
      <![CDATA[   
            select
              *
            from
              Table_Name
            where
              Attribute = :para]]>
   </sql-query>


where org.company.AClass is not mapped as entity.

There are some scenarios where this is useful e.g. if one calls a stored procedure and want the result mapped to a class that can not be mapped to a table because there is no table to map to.
If one runs queries against readonly views provided by foreign or legacy systems that have no primary key (e.g. report data) and hence the class can not be mapped because a key is always required for a mapping.

If there is no way I think this would be a very useful feature for upcoming hibernate versions, because I have seen many questions of that kind in other forums but no solution for that problem.


Cheers

Sebastian


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.