Data loss after update to Quarkus 1.10.5
See original GitHub issueI was running on Quarkus 1.9.1. I recently updated directly to 1.10.5 I started seeing some db entries get wiped out, when accessing a related table. I have been able to reproduce it in my environment with a simple db read now. I use postgres, panache, hibernatesearch among other extensions.
It basically boils down to something like
@Entity
@RegisterForReflection
@Table(name = "books")
@Indexed
public class Book extends PanacheEntityBase implements Serializable {
//various fields...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(updatable = false, name = "shop_id")
@JsonbTransient
private Shop shop;
}
What happens is when I call Book.findById(
), the data in the corresponding Shop entity gets set to null.
I am not sure if there is something wrong, in the way I have written the entity, but this used to work in 1.9
I then took Quarkus v1.10.3 I now get an exception in the same sequence.
14:01:19.625 WARN [co.ar.at.arjuna] beforeCompletion ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a80e70:adb1:5ff8578d:8, org.hibernate.resource.transaction.backend.jta.internal.synchronization.RegisteredSynchronization@147062e3 >: java.lang.NullPointerException
at org.hibernate.persister.entity.AbstractEntityPersister.lambda$resolveDirtyAttributeIndexes$0(AbstractEntityPersister.java:2282)
at java.base/java.util.BitSet$1BitSetSpliterator.forEachRemaining(BitSet.java:1283)
Since the transaction fails, I dont have data loss, but looks like something is trying to overwrite the shop entity Commenting out the Shop entity from Book, causes everything to work ok, in both versions I have tracked down the change in behaviour to the CRM changes in 1.10.4
I have been able to reproduce this reliably in my environment, but havent been able to create a standalone example.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Opened a Jira https://hibernate.atlassian.net/browse/HHH-14424, working on it.
Thanks @yntelectual for the reproducer, I’m going to give a look at it.