[ 
https://issues.apache.org/jira/browse/OPENJPA-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484775
 ] 

Marc Prud'hommeaux commented on OPENJPA-189:
--------------------------------------------

If you just execute the subquery by itself, does it return any results?

Also, can you enable SQL logging and post the SQL that is executed when you run 
the subquery?

> EXISTS conditional operator and subquery don't return values, but they do 
> exist
> -------------------------------------------------------------------------------
>
>                 Key: OPENJPA-189
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-189
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 0.9.7
>            Reporter: Jacek Laskowski
>
> The test says it all. When the line where the condition is checked is removed 
> the test fails with Apache OpenJPA 0.9.7-SNAPSHOT.
>   public void testExists() {
>     Query query = em.createQuery("SELECT DISTINCT p FROM Projekt p WHERE 
> EXISTS (SELECT zaleznosc FROM Projekt zaleznosc WHERE zaleznosc MEMBER OF 
> p.zaleznosci AND zaleznosc.rodzajProjektu = 
> pl.jaceklaskowski.jpa.entity.RodzajProjektu.OTWARTY)");
>     // Apache OpenJPA 0.9.7-SNAPSHOT workaround so the test passes
>     // TopLink Essentials 2.0 BUILD 40 i Hibernate EntityManager 3.3.0.GA 
> work fine
>     if 
> (!em.getClass().getCanonicalName().equals("org.apache.openjpa.persistence.EntityManagerImpl"))
>  {
>       List<Projekt> projekty = query.getResultList();
>       assert projekty.size() == 1 : projekty.size() + " projects received";
>       assert projekty.get(0).getNazwa().equals("Apache Geronimo") : "Should 
> be 'Apache Geronimo', but was " + projekty.get(0).getNazwa();
>     }
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to