We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Querying for a record after making a change using the #update, from PanacheRepository<T> method doesn't reflect the change.
#update
PanacheRepository<T>
Here's an example (the same as in the reproducer artefact attached):
@Test @TestTransaction void changes_fruit_name() throws Exception { repository.persist(new Fruit("apple", "description", "a1")); repository.changeName("Apple: Gala", "a1"); var fruit = repository.find("reference", "a1").firstResult(); assertThat(fruit.getName()).isEqualTo("Apple: Gala"); }
#changeName
@Transactional public void changeName(String name, String reference) { update( "name = :name where reference = :reference", Parameters .with("name", name) .and("reference", reference)); }
The interesting, or weird part is, the expected result is correct when using the entity manager directly, as shown below:
@Test @TestTransaction void changes_fruit_name_checking_natively() throws Exception { repository.persist(new Fruit("apple", "description", "a1")); repository.changeName("Apple: Gala", "a1"); var fruit = (Object[]) repository.getEntityManager() .createNativeQuery("select * from Fruit where reference = ?") .setParameter(1, "a1") .getSingleResult(); assertThat(fruit[1]).isEqualTo("Apple: Gala"); }
Expect to see the record changed when retrieving with #find or other framework methods.
#find
The record returned has the information from the first time it was persisted, as part of the setup.
reproducer-repository-test.tgz
uname -a
ver
Darwin NDg2Nwo 23.3.0 Darwin Kernel Version 23.3.0: Thu Jan 4 13:56:14 PST 2024; root:xnu-10002.81.5~13/RELEASE_ARM64_T8112 arm64 arm Darwin
java -version
openjdk 21.0.2 2024-01-16 LTS OpenJDK Runtime Environment Zulu21.32+17-CA (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Zulu21.32+17-CA (build 21.0.2+13-LTS, mixed mode, sharing)
3.9.3
mvnw --version
gradlew --version
No response
The text was updated successfully, but these errors were encountered:
/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive), @gsmet (hibernate-orm), @mswatosh (db2), @yrodiere (hibernate-orm)
Sorry, something went wrong.
I will have a look at the reproducer
Did you have a chance to take an initial look?
@DavideD is currently unavailable for a few weeks, but I'm sure he'll provide an update when he's back.
No branches or pull requests
Describe the bug
Querying for a record after making a change using the
#update
, fromPanacheRepository<T>
method doesn't reflect the change.Here's an example (the same as in the reproducer artefact attached):
1 Test
2 The implementation of
#changeName
3 Seeing the correct output
The interesting, or weird part is, the expected result is correct when using the entity manager directly, as shown below:
Expected behavior
Expect to see the record changed when retrieving with
#find
or other framework methods.Actual behavior
The record returned has the information from the first time it was persisted, as part of the setup.
How to Reproduce?
reproducer-repository-test.tgz
Output of
uname -a
orver
Darwin NDg2Nwo 23.3.0 Darwin Kernel Version 23.3.0: Thu Jan 4 13:56:14 PST 2024; root:xnu-10002.81.5~13/RELEASE_ARM64_T8112 arm64 arm Darwin
Output of
java -version
openjdk 21.0.2 2024-01-16 LTS OpenJDK Runtime Environment Zulu21.32+17-CA (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Zulu21.32+17-CA (build 21.0.2+13-LTS, mixed mode, sharing)
Quarkus version or git rev
3.9.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)openjdk 21.0.2 2024-01-16 LTS OpenJDK Runtime Environment Zulu21.32+17-CA (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Zulu21.32+17-CA (build 21.0.2+13-LTS, mixed mode, sharing)
Additional information
No response
The text was updated successfully, but these errors were encountered: