Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2705

ArrayOutOfBoundsException occurs with an @EmbeddedId

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.2, 2.2.3
    • Component/s: jpa
    • Labels:
      None

      Description

      Introduced with OPENJPA-2631.

      Exception:
      Caused by: java.lang.ArrayIndexOutOfBoundsException
      at org.apache.openjpa.jdbc.meta.ClassMapping.toDataStoreValue(ClassMapping.java:272)
      at org.apache.openjpa.jdbc.kernel.exps.CollectionParam.calculateValue(CollectionParam.java:174)

      Reproduce:

      @Entity
      public class IdentificationBO {
      	@EmbeddedId private BoIdVersion boId;
      }
      
      @Embeddable
      public class BoIdVersion {
      	private Long id;
      	private Long version;
      }
      
      @Test
      public void queryTest() {
      	EntityManager em = emf.createEntityManager();
      	EntityTransaction et = em.getTransaction();
      	et.begin();
      
      	Query q = em.createQuery("SELECT DISTINCT Ident FROM IdentificationBO Ident WHERE Ident.boId in :identificationList");
      	q.setParameter("identificationList", Arrays.asList(new BoIdVersion(new Long(1)), new BoIdVersion(new Long(2)), new BoIdVersion(new Long(3))));
              //Exception on execution of this line
      	q.getResultList();
      
      	if ((et != null) && (et.isActive())) {
      		et.rollback();
      	}
      	em.close();
      }
      

        Attachments

        1. OPENJPA-2705-2.1.x.patch
          3 kB
          Will Dazey

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dazeydev Will Dazey
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: