-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping aggregate field to class-property
PostPosted: Tue Oct 31, 2006 8:57 am 
Newbie

Joined: Mon Sep 18, 2006 11:36 am
Posts: 10
Location: Germany / Karlsruhe
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 10g
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 12:45 pm 
Newbie

Joined: Fri Jan 26, 2007 11:53 am
Posts: 2
did you resolve this?


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

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.