Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTk4NjQ3NDU4...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15634?atlOrigin=eyJpIjoiYTk4Nj...
) HHH-15634 (
https://hibernate.atlassian.net/browse/HHH-15634?atlOrigin=eyJpIjoiYTk4Nj...
) Lazy basic property does not get updated on change (
https://hibernate.atlassian.net/browse/HHH-15634?atlOrigin=eyJpIjoiYTk4Nj...
)
Issue Type: Bug Affects Versions: 5.6.12, 6.1.4 Assignee: Unassigned Components:
bytecode-enhancement Created: 26/Oct/2022 05:02 AM Fix Versions: 5.6-backlog, 6.wishlist
Priority: Major Reporter: Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
This affects Hibernate ORM 6 *and* 5.6.
This is only relevant with bytecode enhancement enabled to get [lazy basic properties] (
https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibern...
(
https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibern...
) ).
Updating such lazy properties does not seem to work correctly:
* When properties are assigned to fetch groups, there is only one problem: setting a lazy
property to null is ignored, the entity is not updated.
* When properties are *not* assigned to fetch groups:
* setting a lazy property to null is ignored, the entity is not updated.
* setting a lazy property to a non-null value is ignored, the entity is not updated.
* changing only a single lazy property on an entity that has only lazy properties will
lead to an exception:
java.lang.IllegalArgumentException: sql must be non-null.
at
org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.getBatchStatement(AbstractBatchImpl.java:127)
at
org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3544)
at
org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3470)
at
org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3887)
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:136)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:615)
at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:486)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:483)
at
org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:329)
at
org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at
org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1422)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:476)
at
org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2233)
at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:1929)
at
org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:439)
at
org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
at
org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
at
org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
at
org.hibernate.testing.transaction.TransactionUtil.doInHibernate(TransactionUtil.java:372)
at
org.hibernate.orm.test.bytecode.enhancement.lazy.basic.OnlyLazyBasicUpdateTest.updateSomeLazyProperty(OnlyLazyBasicUpdateTest.java:57)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at
org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:829)
I will add a PR with a reproducer here.
(
https://hibernate.atlassian.net/browse/HHH-15634#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15634#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100209- sha1:6031644 )