Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.0
Mapping documents:
Code:
<class
name="domain.bo.Comment"
table="guest_comment"
dynamic-update="true"
dynamic-insert="true"
>
<id
name="id"
type="java.lang.Long"
unsaved-value="null"
>
<column name="ID" sql-type="NUMBER" not-null="true"/>
<generator class="sequence">
<param name="sequence">guest_comment_id_seq</param>
</generator>
</id>
<property
name="parentId"
type="java.lang.Long"
>
<column name="REF" sql-type="NUMBER" not-null="true"/>
</property>
</class>
<sql-query name="domain.bo.Comment.treeChildrenByRootId">
<return alias="comment" class="domain.bo.Comment">
<return-property name="id" column="id"/>
<return-property name="parentId" column="parentId"/>
<return-property name="hierarchicalLevel" column="hierarchicalLevel"/>
</return>
select comment.ID AS id, comment.REF AS parentId, LEVEL AS hierarchicalLevel
from guest_comment comment
start with comment.ID= :rootId connect by comment.REF = prior comment.ID
</sql-query>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
oracle 817
The generated SQL (show_sql=true):
select comment.ID AS id, comment.REF AS parentId, LEVEL AS hierarchicalLevel from GUEST_COMMENT comment start with comment.ID= ? connect by comment.REF = prior comment.ID
Debug level Hibernate log excerpt:
When execute this named query, value of id/parentId can be stored into Comment's id/parentId property correctly. But hierarchicalLevel's value always equals zero. As I know currently, pseudo column -LEVEL can't mapped to PO's property. How can I get value of "LEVEL"? Thanks for any help!