Skip to content

ClassNotFound Exception for org.hibernate.jpa.TypedParameterValue in QueryParameterSetter when using Eclipselink JPA Provider #2902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
azikic opened this issue Apr 5, 2023 · 3 comments
Assignees
Labels
in: repository Repositories abstraction type: regression A regression from a previous release

Comments

@azikic
Copy link

azikic commented Apr 5, 2023

Hi,

after upgrading spring-data-jpa to 2.7.10 (from 2.7.6) I encountered a new Runtime Error when calling a Stored-Procedure.
Class org.springframework.data.jpa.repository.query.QueryParameterSetter has a hard dependency on org.hibernate.jpa.TypedParameterValue and throws a ClassNotFound Exception

Stacktrace:

0 = {StackTraceElement@15990} "org.springframework.data.jpa.repository.query.QueryParameterSetter$NamedOrIndexedQueryParameterSetter.setParameter(QueryParameterSetter.java:95)"
1 = {StackTraceElement@15991} "org.springframework.data.jpa.repository.query.ParameterBinder.bind(ParameterBinder.java:82)"
2 = {StackTraceElement@15992} "org.springframework.data.jpa.repository.query.ParameterBinder.bind(ParameterBinder.java:74)"
3 = {StackTraceElement@15993} "org.springframework.data.jpa.repository.query.StoredProcedureJpaQuery.doCreateQuery(StoredProcedureJpaQuery.java:102)"
4 = {StackTraceElement@15994} "org.springframework.data.jpa.repository.query.StoredProcedureJpaQuery.createQuery(StoredProcedureJpaQuery.java:89)"
5 = {StackTraceElement@15995} "org.springframework.data.jpa.repository.query.JpaQueryExecution$ProcedureExecution.doExecute(JpaQueryExecution.java:318)"
6 = {StackTraceElement@15996} "org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:90)"
7 = {StackTraceElement@15997} "org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:156)"
8 = {StackTraceElement@15998} "org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:144)"
9 = {StackTraceElement@15999} "org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)"
10 = {StackTraceElement@16000} "org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)"
11 = {StackTraceElement@16001} "org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:160)"
12 = {StackTraceElement@16002} "org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:139)"
13 = {StackTraceElement@16003} "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)"
14 = {StackTraceElement@16004} "org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:81)"
15 = {StackTraceElement@16005} "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)"
16 = {StackTraceElement@16006} "org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)"
17 = {StackTraceElement@16007} "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)"
18 = {StackTraceElement@16008} "org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:145)"
19 = {StackTraceElement@16009} "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)"
20 = {StackTraceElement@16010} "org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)"
21 = {StackTraceElement@16011} "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)"
22 = {StackTraceElement@16012} "org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)"
23 = {StackTraceElement@16013} "com.sun.proxy.$Proxy208.generateStatistics(Unknown Source)"
24 = {StackTraceElement@16014} "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"
25 = {StackTraceElement@16015} "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"
26 = {StackTraceElement@16016} "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
27 = {StackTraceElement@16017} "java.lang.reflect.Method.invoke(Method.java:498)"
28 = {StackTraceElement@16018} "org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)"
29 = {StackTraceElement@16019} "org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:106)"
30 = {StackTraceElement@16020} "org.springframework.data.jpa.repository.JpaRepository$IStatisticsEntryDao$1130088037$Proxy$_$$_WeldClientProxy.generateStatistics(Unknown Source)"

This issue appears when calling a repository method backed by a stored procedure.
Example:

@Procedure(procedureName = "PCKSTATISTICS.generateStatistics")
void generateStatistics(@Param("fromDate") LocalDate fromDate, @Param("toDate") LocalDate toDate);

As far as I can tell, this issue was introduced with d64cfd1, a fix for a hibernate related issue.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 5, 2023
@quaff
Copy link
Contributor

quaff commented Apr 7, 2023

@gregturn The workaround should be reverted now.

// TODO: When https://github.com/hibernate/hibernate-orm/pull/5438 is merged we should be able to drop this.
if (query.getQuery() instanceof StoredProcedureQuery) {
Object extractedValue = valueExtractor.apply(accessor);
if (extractedValue instanceof TypedParameterValue) {
value = ((TypedParameterValue) extractedValue).getValue();
} else {
value = extractedValue;
}
} else {
value = valueExtractor.apply(accessor);
}

@mp911de mp911de added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 12, 2023
@gregturn gregturn added the in: repository Repositories abstraction label Apr 28, 2023
@gregturn gregturn added this to the 2.7.12 (2021.2.12) milestone Apr 28, 2023
gregturn added a commit that referenced this issue Apr 28, 2023
gregturn added a commit that referenced this issue Apr 28, 2023
Hibernate resolved hibernate/hibernate-orm#5438, allowing us to no longer implement special handling.

Resolves #2902.
@gregturn gregturn linked a pull request Apr 28, 2023 that will close this issue
@gregturn
Copy link
Contributor

@quaff I tried removing that block, but it wasn't enough. Check out the linked PR for a proposed solution (feedback welcome).

schauder pushed a commit that referenced this issue May 2, 2023
Hibernate resolved hibernate/hibernate-orm#5438, allowing us to no longer implement special handling.

Closes #2902
Original pull request #2933
schauder added a commit that referenced this issue May 2, 2023
Original pull request #2933
See #2902
@schauder
Copy link
Contributor

schauder commented May 2, 2023

That's fixed by 9dbd41e

@schauder schauder closed this as completed May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository Repositories abstraction type: regression A regression from a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants