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.