-->
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: How to retrive objects from one to many using HQL or Cri API
PostPosted: Thu Oct 16, 2014 8:22 am 
Newbie

Joined: Thu Oct 16, 2014 8:14 am
Posts: 1
Started to learn hibernate with examples. I have written a class "Team" that has one to many relationship with (a Collection of) players.

I need to get all the teams

1. where one player's name is "X" (X is not the primary key of the Player table)
2. where player "Y" ("Y" contains name, id, age... etc properties) is playing for

I think I have to get this done by using Criteria API or the HQL. Can someone tell how I can achieve it.


Top
 Profile  
 
 Post subject: Re: How to retrive objects from one to many using HQL or Cri API
PostPosted: Mon Oct 20, 2014 7:28 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

Hibernate OGM does not yet support the Criteria API; (simple) HQL queries work, but there is no support for joins (as most NoSQL stores don't support joins themselves). You may try to work with native queries (supported for MongoDB and Neo4j). Which datastore are you using?

Or is this question actually not about Hibernate OGM (= object persistence for NoSQL stores) but rather about Hibernate ORM (object-relational mapping for classic RDBMS?

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


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.