OpenJPA
  1. OpenJPA
  2. OPENJPA-508

JPQL EXISTS clauses do not handle subclasses properly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0, 1.0.1
    • Fix Version/s: 1.0.2, 1.1.0
    • Component/s: None
    • Labels:
      None

      Description

      The following code does not properly add subclass indicators to the generated SQL query:

      StringRootEntity e = new StringRootEntity();
      e.setName("foo");
      em.persist(e);

      e = new StringRootEntity();
      e.setName("foo");
      em.persist(e);

      e = new StringRootEntity();
      e.setName("bar");
      em.persist(e);

      em.flush();

      Query q = em.createQuery("select o from StringAbstractEntity o " +
      "where exists (select o2 from StringLeafEntity o2)");
      List<StringAbstractEntity> list = q.getResultList();
      assertEquals(0, list.size());

      The assertion at the end fails; 3 results are returned, even though there are no SingleLeafEntity instances in the store.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Patrick Linskey
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development