Hibernate - @ManyToOne strange behavior
See original GitHub issueDescribe the bug Imagine the relationship described below: “one” User -> “many” Message In Message class, there is @ManyToOne(fetch = FetchType.LAZY, optional = false) User user; annotation. When a new Message instance are created, we need to persist the object on database with related User “id”. I find the related User using EntityManager.find(clazz, id)
Expected behavior Insert the new Message on database, do not make any operation with User
Actual behavior After insert Message, Hibernate tries to update the User instance without any field.
To Reproduce Steps to reproduce the behavior:
- Create a User instance on database and persist.
- In other transaction, create a Message and set the existent User
- Persist the Message
Configuration
# We are using Postgres Database
Can reproduce issue only in quarkus 0.23x, on 0.22 works fine with same config.
Issue Analytics
- State:
- Created 4 years ago
- Comments:33 (10 by maintainers)
Top Results From Across the Web
Hibernate and strange OneToMany behaviour - Stack Overflow
I've got a strange behavior when chaining multiple entities. I got three Entities, where E1 contains a OneToMany-List of E2 which also contains ......
Read more >[Solved]-Hibernate and strange OneToMany behaviour-Springboot
Coding example for the question Hibernate and strange OneToMany behaviour-Springboot.
Read more >Strange issue on @ManyToOne - Hibernate Envers - JBoss.org
I am using Hibernate 3.5.6-Final and prototyping envers for a project and have some strange behaviour (or what looks like strange behaviour ......
Read more >Strange behaviors in @OneToMany relationship.
Newbie. Joined: Mon Oct 17, 2011 5:34 am. Posts: 1. I'm trying to create a simple Parent/Child relationship with the JPA 2 API...
Read more >Hibernate with strange behavior - CodeRanch
In some tests with Hibernate, to remove an entity that appears in 3 lines of an intermediate table, instead of removing it to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @rafaelkloss , if you could share a little project reproduing it we will debug it.
Alternatively, could you try building a snapshot from Hibernate ORM master and try that? We already fixed a related issue, so I’m wondering if it’s the same (or not …)
Hi folks, thanks for your effort, this is a great new ! Very best 😃
Em sex., 15 de nov. de 2019 às 08:28, Sanne Grinovero < notifications@github.com> escreveu:
–
{ name : “Rafael Kloss”,
location : “Curitiba, PR”,
iata : “CWB”,
twitter : [“@rafa_kloss https://twitter.com/rafa_kloss”}