You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Will Dazey (JIRA)" <ji...@apache.org> on 2017/07/14 15:46:00 UTC

[jira] [Updated] (OPENJPA-2705) ArrayOutOfBoundsException occurs with an @EmbeddedId

     [ https://issues.apache.org/jira/browse/OPENJPA-2705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Dazey updated OPENJPA-2705:
--------------------------------
    Description: 
Introduced with [OPENJPA-2631|https://issues.apache.org/jira/browse/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:

Entities:
{code:java}
@Entity
public class IdentificationBO {
	@EmbeddedId private BoIdVersion boId;
}
{code}

{code:java}
@Embeddable
public class BoIdVersion {
	private Long id;
	private Long version;
}
{code}

Test:

{code:java}
	@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();
	}
{code}



  was:
Introduced with [OPENJPA-2631|https://issues.apache.org/jira/browse/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:

Entities:
@Entity
public class IdentificationBO {
	@EmbeddedId private BoIdVersion boId;
}
@Embeddable
public class BoIdVersion {
	private Long id;
	private Long version;
}

Test:
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 encountered here
q.getResultList();


> ArrayOutOfBoundsException occurs with an @EmbeddedId
> ----------------------------------------------------
>
>                 Key: OPENJPA-2705
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2705
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Will Dazey
>
> Introduced with [OPENJPA-2631|https://issues.apache.org/jira/browse/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:
> Entities:
> {code:java}
> @Entity
> public class IdentificationBO {
> 	@EmbeddedId private BoIdVersion boId;
> }
> {code}
> {code:java}
> @Embeddable
> public class BoIdVersion {
> 	private Long id;
> 	private Long version;
> }
> {code}
> Test:
> {code:java}
> 	@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();
> 	}
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)