Skip to content
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

Problem with update statement and MariaDB since Spring Boot 3.4.X #3722

Open
hugograf opened this issue Dec 19, 2024 · 1 comment
Open

Problem with update statement and MariaDB since Spring Boot 3.4.X #3722

hugograf opened this issue Dec 19, 2024 · 1 comment
Labels
for: external-project For an external project and not something we can fix status: waiting-for-feedback We need additional information before we can continue

Comments

@hugograf
Copy link

Since the update to Spring Boot 3.4.X, the execution of

stockexchangeJpaRepository.updateHistoricalUpdateWithNowForAll();

The query is as follows:

@Query(value = "UPDATE stockexchange SET last_direct_price_update = UTC_TIMESTAMP() WHERE no_market_value = 0", nativeQuery = true)
void updateHistoricalUpdateWithNowForAll();

The corresponding error:

org.springframework.orm.jpa.JpaSystemException: JDBC exception executing SQL [UPDATE stockexchange SET last_direct_price_update = UTC_TIMESTAMP() WHERE no_market_value = 0] [PrepareStatement.executeQuery() command does NOT return a result-set as expected. Either use PrepareStatement.execute(), PrepareStatement.executeUpdate(), or correct command] [n/a]
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:341)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:241)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:560)
	at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
	at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:343)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:160)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:136)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
	at jdk.proxy2/jdk.proxy2.$Proxy272.updateHistoricalUpdateWithNowForAll(Unknown Source)
	at grafioschtrader.repository.SecurityJpaRepositoryImpl.catchAllUpSecurityHistoryquote(SecurityJpaRepositoryImpl.java:137)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)

The environment is a MariaDB:

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

Since 3.4.X I also get the following unpleasant message when starting the Spring Boot application:

2024-12-19 16:14:44.672�[0;39m �[32m INFO�[0;39m �[35m25172�[0;39m �[2m--- [           main] �[0;39m�[36morg.hibernate.orm.connections.pooling   �[0;39m �[2m:�[0;39m HHH10001005: Database info:
	Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
	Database driver: undefined/unknown
	Database version: 10.4.27
	Autocommit mode: undefined/unknown
	Isolation level: undefined/unknown
	Minimum pool size: undefined/unknown
	Maximum pool size: undefined/unknown

On the other hand, the MariaDB is working.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 19, 2024
@schauder schauder added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 20, 2024
@schauder
Copy link
Contributor

This sounds very much like a Hibernate issue, since all the JPA mapping is done by it.
I recommend creating a reproducer based purely on Hibernate and submitting an issue with them.

If you think this is actually a Spring Data issue, please provide a reproducer for the issue including a test case that demonstrates the correct behaviour using the EntityManager directly.

The log message actually says, it comes from Hibernate.
The exception does probably as well, but it is hard to tell, because you didn't include the full stack trace.

@schauder schauder added the status: waiting-for-feedback We need additional information before we can continue label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: waiting-for-feedback We need additional information before we can continue
Projects
None yet
Development

No branches or pull requests

3 participants