You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jacek Laskowski (JIRA)" <ji...@apache.org> on 2007/03/28 10:03:32 UTC

[jira] Created: (OPENJPA-189) EXISTS conditional operator and subquery don't return values, but they do exist

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.


[jira] Commented: (OPENJPA-189) EXISTS conditional operator and subquery don't return values, but they do exist

Posted by "Marc Prud'hommeaux (JIRA)" <ji...@apache.org>.
    [ 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.