generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Labels
bugSomething isn't workingSomething isn't workingpending releaseResolution implemented, pending official releaseResolution implemented, pending official release
Description
Describe the bug
Using Hibernate 6.5 and org.springframework.boot:spring-boot-starter-data-jpa writes fail.
Expected Behavior
Driver to work w/ Spring Boot 3.3 & Hibernate 6.5
What plugins are used? What other connection properties were set?
defaults for SF_D0 configuration profile
Current Behavior
Writes fail with this stack trace:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.ClassCastException: class software.amazon.jdbc.wrapper.StatementWrapper cannot be cast to class java.sql.PreparedStatement (software.amazon.jdbc.wrapper.StatementWrapper is in unnamed module of loader 'app'; java.sql.PreparedStatement is in module java.sql of loader 'platform')] with root cause
java.lang.ClassCastException: class software.amazon.jdbc.wrapper.StatementWrapper cannot be cast to class java.sql.PreparedStatement (software.amazon.jdbc.wrapper.StatementWrapper is in unnamed module of loader 'app'; java.sql.PreparedStatement is in module java.sql of loader 'platform')
at org.hibernate.generator.values.internal.GeneratedValuesHelper.readGeneratedValues(GeneratedValuesHelper.java:147)
at org.hibernate.generator.values.internal.GeneratedValuesHelper.getGeneratedValues(GeneratedValuesHelper.java:103)
at org.hibernate.id.insert.GetGeneratedKeysDelegate.performMutation(GetGeneratedKeysDelegate.java:121)
at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorStandard.performNonBatchedOperations(MutationExecutorStandard.java:233)
at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:55)
at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.doStaticInserts(InsertCoordinatorStandard.java:194)
at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.coordinateInsert(InsertCoordinatorStandard.java:132)
at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.insert(InsertCoordinatorStandard.java:95)
at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:85)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:670)
at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:291)
at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:272)
at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:322)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:391)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:305)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:224)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:137)
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:175)
at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:93)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:77)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:54)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:757)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:741)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:319)
at jdk.proxy3/jdk.proxy3.$Proxy233.persist(Unknown Source)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:619)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:277)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516)
at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:168)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:164)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
Reproduction Steps
A simple Spring Boot project using org.springframework.boot:spring-boot-starter-data-jpa and performing an insert via JpaRepository::save is sufficient.
I am able to reproduce in a simple repo integration test that's stood up with @DataJpaTest. Partial code:
@Import(AwsJdbcDriverConfiguration)
@DataJpaTest
@ActiveProfiles('local')
@AutoConfigureTestDatabase(replace = NONE)
class AuctionRepositorySpec extends Specification {
@Autowired
private AuctionRepository repo
@Autowired
private CompanyRepository companyRepo
def "should find all auctions by company GUID"() {
given:
// stack trace is thrown on the next line by companyRepo.save
CompanyEntity company = companyRepo.save(CompanyFixtures.companyEntity())
AuctionEntity auction = repo.save(AuctionFixtures.auctionEntity(company : company))
when:
Page<AuctionEntity> auctionEntities = repo.findAllByCompanyGuid(auction.company.guid, Pageable.unpaged())
then:
auctionEntities.content == [auction]
}
}A full SSCCE would be difficult since it needs to create a table, the JPA entity, etc.
Possible Solution
No response
Additional Information/Context
Isolated this to the Hibernate version by running 4 different scenarios:
- Spring Boot 3.3 & Hibernate 6.5.2.Final - fail
- Spring Boot 3.3 & Hibernate 6.4.9.Final - pass
- Spring Boot 3.2 & Hibernate 6.5.2.Final - fail
- Spring Boot 3.2 & Hibernate 6.4.9.Final - pass
The AWS Advanced JDBC Driver version used
2.3.6 and 2.3.7
JDK version used
21
Operating System and version
Linux
elveskevtar
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpending releaseResolution implemented, pending official releaseResolution implemented, pending official release