Subquery error

#1

My query:

TypedQuery<Station> query = em.createQuery("SELECT p FROM Station p WHERE rid = (SELECT p FROM Station p where tpl='York') AND tpl != 'York'", Station.class);

Error:

Exception in thread "main" [ObjectDB 2.6.6_04] SELECT p FROM Station p WHERE rid = ( ==> SELECT <==  p FROM Station p where tpl='York') AND tpl != 'York'
javax.persistence.PersistenceException
Unexpected query token 'SELECT' (error 752)
(position 37) at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:728)
at Main.main(Main.java:37)
Caused by: com.objectdb.o.UserException: Unexpected query token 'SELECT'

Is this the correct way of using a subquery? Or is this not possible?

Thanks,

Marvin

#2

Unfortunately this is one of the few JPA features that are not supported yet.

ObjectDB Support

Reply