-->
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.  [ 4 posts ] 
Author Message
 Post subject: Relationship Queries not Supported - Plus, ...
PostPosted: Mon Dec 01, 2014 12:54 pm 
Newbie

Joined: Sun Nov 30, 2014 1:43 pm
Posts: 8
I am trying to use the following query:

Code:

public CollectionItem getCollectionItemByItemId(String id)
   {
      
      String nativeQuery = "{'item_id':{'$oid' : '" + id + "'}}";
      //javax.persistence.Query q = em.createQuery("SELECT item FROM CollectionItem ci WHERE ci.item.id = '" + id + "'");
      
      try
      {
         javax.persistence.Query query = em.createNativeQuery(nativeQuery, CollectionItem.class);
         return (CollectionItem)query.getSingleResult();
      }
      catch(NoResultException e)
      {
         //no result
      }
      
      return null;
   }


The commented out code is a query that is currently not supported. Unfortunately, when I switch to the native query, I run into the existing error of not being able to execute multiple native queries in a single request. That causes the error: "cannot associate the collection with multiple sessions" error. I tried to pull down the latest OGM code and build it to see if some of these issues have been resolved but I ran into trouble there as well.


Top
 Profile  
 
 Post subject: Re: Relationship Queries not Supported - Plus, ...
PostPosted: Mon Dec 01, 2014 2:08 pm 
Newbie

Joined: Sun Nov 30, 2014 1:43 pm
Posts: 8
I was finally able to wade through the build issues I was having and use the latest SNAPSHOT to get past this problem.


Top
 Profile  
 
 Post subject: Re: Relationship Queries not Supported - Plus, ...
PostPosted: Tue Dec 02, 2014 9:05 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Ok, cool! That issue you run into is https://hibernate.atlassian.net/browse/OGM-638, glad to hear that the fix on master works for you. Will be part of the upcoming RC1 release.

--Gunnar

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


Top
 Profile  
 
 Post subject: Re: Relationship Queries not Supported - Plus, ...
PostPosted: Thu Dec 11, 2014 3:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
For your info, the CR1 fixing your problem has been released.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.