I have a named sql-query for which I have attempted to simulate the dynamic instantiation behavior that is available when using an HQL query
- e.g. select new ItemRow( item.id, item.desc) from Item item
I am using
Hibernate version: 2.1.3. The Database is
DB2.
The following mapping seems to work but it appears to be slow in comparsion to runing the same SQL in directly from an isql tool.
Is my approach bad? Did I missing anything obvious in my configuration?
Mapping documents:
Code:
<class name="ReportItem" mutable="false" >
<id name="myId">
<generator class="assigned"/>
</id>
<property name="firstName" />
<property name="lastName" />
</class>
<sql-query name="listMyData">
<return alias="item" class="ReportItem"/>
<![CDATA[
select
t.first_nm as {item.firstName},
t.last_nm as {item.lastName}
from
my_table t
</sql-query>
Mark