-->
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.  [ 3 posts ] 
Author Message
 Post subject: Unable to query entities using with ManyToOne relation
PostPosted: Mon Jul 06, 2015 3:06 am 
Newbie

Joined: Mon Jul 06, 2015 2:55 am
Posts: 2
Hi all

I have been trying to query entities with @ManyToOne relation. I have similar classes as below:

Parent entity:
Code:
@Entity
public class Parent {
    ...
   @OneToMany (mappedBy = "parent",
            cascade = { CascadeType.PERSIST, CascadeType.MERGE },
            fetch = FetchType.EAGER
   )
   private Set<Child> childs = new HashSet<>();
   
   ...
}


and Child entity:

Code:
@Entity
public class Child {
   ...
   @ManyToOne
   private Parent parent;
   
   ...
}


And used query:
Code:
public Child getChildByParentID(String parentid) {
        return entityManager.createQuery( "SELECT c FROM Child c WHERE c.parent.id  = :parentid", Child.class )
                .setParameter("parentid", parentid)               
                .getResultList().get(0);
    }


Query fails to:
java.lang.UnsupportedOperationException: Unrecognized property type: org.hibernate.type.ManyToOneType(package.Parent)

Other types of queries works fine, but querying via ManyToOne relation (c.parent.id) does not.

I'm using Hibernate OGM 4.2.final with Wildfly 9.0CR2.


Top
 Profile  
 
 Post subject: Re: Unable to query entities using with ManyToOne relation
PostPosted: Mon Jul 06, 2015 3:12 am 
Newbie

Joined: Mon Jul 06, 2015 2:55 am
Posts: 2
Seems to be similar to:
https://forum.hibernate.org/viewtopic.php?f=31&t=1039494


Top
 Profile  
 
 Post subject: Re: Unable to query entities using with ManyToOne relation
PostPosted: Tue Jul 07, 2015 11:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Yes that's similar. For that particular query we don't need actual join support so I've put it as a candidate for our next sprint work.

_________________
Emmanuel


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