Skip to content

EntityViewRepository findAll(start,max) fails with ClassCastException #720

@ghost

Description

findAll(start, max) method of the Repository fails with java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long for eclipselink embedded composite primary key. It works with hibernate 5.0.12.Final.

I am referring deltaspike-data-rest example with tomcat web server and CDI injection.

Expected behavior

findAll(start,max) should return the List<CompositeView>

Actual behavior

Exception is:
Caused by: org.apache.deltaspike.data.api.QueryInvocationException: Failed calling Repository: [Repository=com.blaze.poc.CompositeViewRepository,entity=com.blaze.poc.CompositeKeyEntity,method=findAll,exception=class java.lang.reflect.InvocationTargetException,message=null
	at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewDelegateQueryBuilder.invoke(EntityViewDelegateQueryBuilder.java:118)
	at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewDelegateQueryBuilder.execute(EntityViewDelegateQueryBuilder.java:61)
	... 14 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewDelegateQueryBuilder.invoke(EntityViewDelegateQueryBuilder.java:113)
	... 15 more
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
	at com.blazebit.persistence.impl.PaginatedTypedQueryImpl.getResultList(PaginatedTypedQueryImpl.java:158)
	at com.blazebit.persistence.impl.PaginatedTypedQueryImpl.getResultList(PaginatedTypedQueryImpl.java:45)
	at com.blazebit.persistence.deltaspike.data.base.handler.AbstractEntityViewAwareRepositoryHandler.findAll(AbstractEntityViewAwareRepositoryHandler.java:286)
	... 20 more

Steps to reproduce

  1. Downloaded deltaspike-data-rest example
  2. Marked config beans to ApplicationScoped
  3. Created CompositeKeyEntity with embedded CompositePK and EntityView (CompositeView, CompositeIdView). CompositePK contains 2 fields (String, java.sql.Timestamp)
  4. Created CompositeViewRepository by extending EntityViewRepository<CompositeKeyEntity, CompositeView, CompositePK>.
  5. Created test class to test default repository methods. findBy method works, but findAll(0,10) fails.

Environment

Version: 1.3.1/1.3.0
JPA-Provider: Eclipselink 2.6.4, Deltaspike 1.8.1
DBMS: DB2 11 for z/OS, Driver: IBM Data Server Driver for JDBC and SQLJ Version: 4.21.29
Web Server: Tomcat, CDI

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions