OpenJPA
  1. OpenJPA
  2. OPENJPA-2065

JPA 2.0 Spec. Violation? EntityManager#createNamedQuery(String, Class) bombs with non-entity Class parameter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0, 2.1.1, 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: jpa
    • Labels:

      Description

      Suppose we have an interface, A.

      Suppose we have a JPA-compliant entity class, B, that implements A.

      This construction will fail at runtime:

      final TypedQuery<A> q = em.createNamedQuery("someNamedQuery", A.class);

      Hibernate and EclipseLink both accept this construction.

      I don't see anywhere in the JPA specification that the class parameter must denote an entity type.

        Issue Links

          Activity

          Albert Lee made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Albert Lee made changes -
          Link This issue relates to OPENJPA-2071 [ OPENJPA-2071 ]
          Rick Curtis made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Rick Curtis made changes -
          Assignee Rick Curtis [ curtisr7 ]
          Rick Curtis made changes -
          Fix Version/s 2.2.0 [ 12315910 ]
          Affects Version/s 2.2.0 [ 12315910 ]
          Laird Nelson made changes -
          Affects Version/s 2.1.1 [ 12316191 ]
          Description Suppose we have an interface, A.

          Suppose we have an entity, B, that implements A.

          This construction will fail at runtime:

          final TypedQuery<A> q = em.createNamedQuery("someNamedQuery", A.class);

          I don't see anywhere in the JPA specification that the class parameter must denote an entity type.
          Suppose we have an interface, A.

          Suppose we have a JPA-compliant entity class, B, that implements A.

          This construction will fail at runtime:

          final TypedQuery<A> q = em.createNamedQuery("someNamedQuery", A.class);

          Hibernate and EclipseLink both accept this construction.

          I don't see anywhere in the JPA specification that the class parameter must denote an entity type.
          Labels specification
          Laird Nelson made changes -
          Field Original Value New Value
          Description Suppose we have an interface, A.

          Suppose we have an entity, B, that implements A.

          This construction will fail at runtime:

          {code}
          final TypedQuery<A> q = em.createNamedQuery("someNamedQuery", A.class);
          {code}

          I don't see anywhere in the JPA specification that the class parameter must denote an entity type.
          Suppose we have an interface, A.

          Suppose we have an entity, B, that implements A.

          This construction will fail at runtime:

          final TypedQuery<A> q = em.createNamedQuery("someNamedQuery", A.class);

          I don't see anywhere in the JPA specification that the class parameter must denote an entity type.
          Laird Nelson created issue -

            People

            • Assignee:
              Rick Curtis
              Reporter:
              Laird Nelson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development