blaze-persistence icon indicating copy to clipboard operation
blaze-persistence copied to clipboard

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

Open Pilpin opened this issue 2 years ago • 4 comments

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 avatar Jul 13 '23 10:07 Pilpin

@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 ?

Pilpin avatar Jul 19 '23 10:07 Pilpin

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.

beikov avatar Jul 19 '23 11:07 beikov

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

Enjoy your vacation !

Pilpin avatar Jul 19 '23 11:07 Pilpin

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

Pilpin avatar Jul 20 '23 07:07 Pilpin