These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Extending class definition
PostPosted: Fri Jan 26, 2007 12:08 pm 
Newbie

Joined: Fri Jan 26, 2007 11:53 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.