-->
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: many-to-one and join from opposite side
PostPosted: Wed Dec 01, 2010 4:16 pm 
Newbie

Joined: Wed Dec 01, 2010 3:56 pm
Posts: 1
hello :)
I want to perform select using HQL like this in SQL. One article can have multiple comments and multiple pictures. I need to select top 10 articles with comments and pictures.

Code:
SELECT * FROM article a LEFT JOIN comment c on (a.article_id=c.article_id) LEFT JOIN pictures p on (a.article_id=p.article_id) LIMIT 0,10


mappings are in both comment and pictures same:
Code:
<many-to-one name="article" class="Project.Article" column="article_id" not-null="true"/>


thanks in advance for helping me.


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.