-->
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: Hibernate query across OneToMany & ManyToOne
PostPosted: Wed Mar 15, 2006 10:46 pm 
Newbie

Joined: Tue Jan 24, 2006 9:55 pm
Posts: 7
I've been trying to find an answer for my question here but I am not really sure what to search for. I've also read the HQL guide but didn't make my code work.

I have three objects. First object (Document) has a OneToMany connection to an object CoAuthor (so a Set coAuthors is a field in Document). The Object CoAuthor is connected (ManyToOne) to an object User (so User user is a field in the object CoAuthor). User has a field username. Just for imagination, getting username of first co-author of a document would be document.coAuthors.get(0).user.username. Another complication is that the user can be null (there's a @NotFound(ignore) statement for User user in CoAuthor object).

Now what I need is to get all co-author's documents if I know his username. So something like "from Document as doc where 'john' in doc.coAuthors.user.username".

I know my description is not very good, but I hope you will understand what I need.

Thank you for your advice.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 17, 2006 7:30 pm 
Newbie

Joined: Tue Jan 24, 2006 9:55 pm
Posts: 7
Does anyone know an answer for this? Please help! Thank you.


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.