Hi,
I am using OGM and trying to write a query to retrieve a parent object (person) by defining the existence of a child object (email). However, when running this code I obtain the following exception. I can run such a query in Hibernate ORM. Is OGM lacking the ability to convert this query into a native query for my mongodb storage unit?
exception in thread "main" java.lang.IllegalStateException: Can't target multiple types: org.Person already selected before org.Email
Code: OgmSession ogmSession = em.unwrap(OgmSession.class); Query query = ogmSession.createQuery("from Person as p " + "where exists (select e from Email as e where e.email = :email " + "AND e member of p.emailList)"); query.setParameter("email", email); return (Person) query.uniqueResult();
person.emailList is a collection of Email entities.
|