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