Hibernate Books

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Join a table with itself, criteria or hql?
PostPosted: Thu Apr 26, 2012 11:27 am 

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.

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

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

techno_id | description | parent

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.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.