-->
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: Join a table with itself, criteria or hql?
PostPosted: Thu Apr 26, 2012 11:27 am 
Newbie

Joined: Thu Apr 26, 2012 11:08 am
Posts: 1
Hi to everyone.

I have a problem joining a table. Actually i'm really lost of how to do it.

I have this table mapping.

Code:
<class name="Technology" table="TECHNOLOGIES">
         <id name="technoId">
            <column name="techno_id" />
            <generator class="identity" />
         </id>       
        <property name="description" type="java.lang.String">
            <column name="description" />
        </property>
        <many-to-one name="parent" class="Technology" />
    </class>


The column parent is related with the same table. An example of the table so you can understand me.

techno_id | description | parent
1----------"Java"--------null
2----------"Hibernate"----1
3----------"HQL"---------2
4----------".NET"--------null
5----------"NHibernate"--4

That's basically an example of the table, it doesn't have real data, it's just an example.
What I want to do is, in a method that receives a techno_id, run with Criteria or HQL, and that brings me a List of results with the children id's too.
For example, if I send to the method the "1" techno_id, it should bring me a List with the ids "1, 2, 3".
I hope I was as clear as possible and you can help me.
Thanks, and sorry for my english jaja.


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.