question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hibernate - @ManyToOne strange behavior

See original GitHub issue

Describe 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:

  1. Create a User instance on database and persist.
  2. In other transaction, create a Message and set the existent User
  3. 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:closed
  • Created 4 years ago
  • Comments:33 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Sannecommented, Oct 9, 2019

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 …)

0reactions
rafaelklosscommented, Nov 18, 2019

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:

hi @rafaelkloss https://github.com/rafaelkloss we merged the Hibernate ORM upgrade, this should be fixed now thanks to @dreab8 https://github.com/dreab8 .

Since he ported your test to be incorporated into the ORM integration tests, I’m closing this one but please could you check on your original case as well 😃

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/quarkusio/quarkus/issues/4377?email_source=notifications&email_token=ABUKGA2PG3BSECIJ3MLANH3QT2BXPA5CNFSM4I5PW7TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEFFIGI#issuecomment-554325017, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUKGA6QZIWQGXT5XGQIISTQT2BXPANCNFSM4I5PW7TA .

{ name : “Rafael Kloss”,

location : “Curitiba, PR”,

iata : “CWB”,

twitter : [“@rafa_kloss https://twitter.com/rafa_kloss”}

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found