Hello, I have a table like this:
create table category (
category_id // is the primary key
name
parent // for a hierarchy category
}
My mapping is something like this
<class name="Category" table="CATEGORY">
<id name="categoryId" type="java.lang.Long">
<column name="category_id"/>
</id>
<property name="name" type="java.lang.String">
<column name="NAME"/>
</property>
</class>
I need a query with a organized hierarchy, something like this (in oracle)
SELECT category_id AS {category.categoryId}, NAME as {category.name}, parent as {category.parent},level as {category.level}
FROM category {category}
CONNECT BY PRIOR {category}.categoryId = {category}.parent
START WITH {category}.parent IS NULL
The question is, if I have the class definition, and I need another column like "level", how to map this new column, based on the original class "Category", something like a new class "CategoryLevel".
Than you
|