Blazebit / blaze-persistence

Rich Criteria API for JPA providers
https://persistence.blazebit.com
Apache License 2.0
741 stars 90 forks source link

@UpdatableEntityView(strategy = FlushStrategy.ENTITY) not updating database #1761

Open Pilpin opened 1 year ago

Pilpin commented 1 year ago

Description

When using @UpdatableEntityView(strategy = FlushStrategy.ENTITY) the entity is not flushed to the database.

Expected behavior

The database is updated.

Actual behavior

The database is not updated

Steps to reproduce

Here a special test case using quarkus : https://github.com/Pilpin/blaze-update-bug I tried to use the template project for the test case but had a lot of exceptions that I did not understand so I gave up, sorry.

Environment

JPA-Provider: Hibernate 6.2.5
DBMS: PostgreSQL 15.0 and H2
Application Server: Quarkus 3.2.0

Pilpin commented 1 year ago

@beikov Do you have any idea of what the cause of this could be ?

From what I understand using the debugger, blaze is not responsible for merging the entity, hibernate should do it at the next flush, is it right ?

I tested the creation of an entity, something like this

var view = evm.create(SomeView.class);
view.update(input);
evm.save(em, view);

And it works fine, but blaze is the one calling persist in this case, right ?

beikov commented 1 year ago

From what I understand using the debugger, blaze is not responsible for merging the entity, hibernate should do it at the next flush, is it right ?

Correct.

And it works fine, but blaze is the one calling persist in this case, right ?

Yes.

Do you have any idea of what the cause of this could be ?

Unfortunately, I don't know what the reason for that could be. It's the first time that I hear of this problem. I'd have to dig into your test case to understand this, but I'm still on vacation.

Pilpin commented 1 year ago

Thank you for answering. I'll try to dig a bit more when I have some time on my hands.

Enjoy your vacation !

Pilpin commented 1 year ago

Just an FYI, I added a branch on my reproducer to try it with Quarkus 2 and blaze-persistence 1.6.8, the problem was apparently already there. https://github.com/Pilpin/blaze-update-bug/tree/1.6.8