Hi there,
i'm using named native sql-query in my mapping file to get Categories in the nested order.
eg:
Cat 1
Cat 1.1
Cat 1.2
Cat 2
Cat 2.1
..and so on
this is my mapping file:
Code:
<hibernate-mapping package="mydomain.model">
<class name="category">
<id name="id" type="integer"><generator class="native" /></id>
<property name="name" column="name" type="string"/>
<many-to-one name="parent" class="Category" column="parent_id"/>
</class>
<sql-query name="getCategoriesNested">
<return alias="category" class="Category">
<return-property name="level" column="level"/>
</return>
<![CDATA[
select category.*, level
from category
start with id=:id
connect by prior id=parent_id
]]>
</sql-query>
</hibernate-mapping>
Getting the records out of DB works fine, but i want to have the "level"-property (which delievers ORACLE) in my Pojo (eg. Category.getLevel()).
Is there a possibility to map it to a class property?
Thanks in advance, Patrick
Hibernate version: 3 Oracle 10gCode: