You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an Entity has multiple JPA associations (i.e. ManyToOne, ManyToMany and OneToMany), a removal to the ManyToOne field is not persisted when doing a PUT call.
To reproduce execute the test $ ./mvnw test -Dtest=PersonEndpointTest
Reproducer
The reproducer application has the Person entity with the following associations:
M:1 with Country
M:N with Fruits
1:M with Car
The bean is deliberately missing the accessor methods for managing changes to associations with Fruits and Cars.
The test() method, basically, posts a Person with a valid Country and then it sends a PUT with a null country but the country is not updated consistently due to a "wrong" update query:
Hibernate:
update
Person
set
birth=?,
name=?
where
id=?
Commenting one of @ManyToMany or @OneToMany associations (@Transient annotation ready to be decommented) makes the test to work thanks to the execution of the expected update query.
I've also provided a testDb() method that works directly with the DB and it's not affected by the same issue.
Configuration
Screenshots
Environment (please complete the following information):
Output of uname -a or ver
Linux 5.10.16-200.fc33.x86_64 #1 SMP Sun Feb 14 03:02:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment 18.9 (build 11.0.10+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode, sharing)
GraalVM version (if different from Java)
Quarkus version or git rev
999-SNAPSHOT (build 20210323.071124-626)
Build tool (ie. output of mvnw --version or gradlew --version)
Describe the bug
When an
Entity
has multiple JPA associations (i.e.ManyToOne
,ManyToMany
andOneToMany
), a removal to theManyToOne
field is not persisted when doing aPUT
call.Expected behavior
Get all the fields updated.
Actual behavior
The
ManyToOne
field is not part of the update.To Reproduce
The reproducer is available at multiple-associations/hibernate-orm-panache-quickstart (based on from
hibernate-orm-panache-quickstart
fromdevelopment
branch).To reproduce execute the test
$ ./mvnw test -Dtest=PersonEndpointTest
Reproducer
The reproducer application has the
Person
entity with the following associations:Country
Fruits
Car
The bean is deliberately missing the accessor methods for managing changes to associations with
Fruits
andCars
.The
test()
method, basically, posts aPerson
with a validCountry
and then it sends aPUT
with anull
country but the country is not updated consistently due to a "wrong" update query:Commenting one of
@ManyToMany
or@OneToMany
associations (@Transient
annotation ready to be decommented) makes the test to work thanks to the execution of the expected update query.I've also provided a
testDb()
method that works directly with the DB and it's not affected by the same issue.Configuration
Screenshots
Environment (please complete the following information):
Output of
uname -a
orver
Linux 5.10.16-200.fc33.x86_64 #1 SMP Sun Feb 14 03:02:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
GraalVM version (if different from Java)
Quarkus version or git rev
999-SNAPSHOT
(build20210323.071124-626
)Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Additional context
(Add any other context about the problem here.)
quarkusio#15961
The text was updated successfully, but these errors were encountered: