Option "Retrieve the entity again using a query" is marked as wrong and explanation says : "JPA specification does not specify what happens to a managed entity if it is included in a result of a query. In many cases, the entity manager does not refresh the existing entity in the persistence context."
But on other hand JPA specification says that result of the query (in case of FlushModeType.AUTO) shall reflect current state, and should not return stale data.
About Question enthuware.oce-jpad.v6.2.462 :
Moderator: admin
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.462 :
Right, but that is only in the case of in case of FlushModeType.AUTO.
If you like our products and services, please help us by posting your review here.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.462 :
But in problem it is assumed that default are applied.
At least I think so because JPA is mainly configuration by exception, is not it?
At least I think so because JPA is mainly configuration by exception, is not it?
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.462 :
Unless it says so explicitly in any question you should not assume anything. For example, if a problem mentions an application exception without showing its complete code or without specifying that it has set rollback=false, you should not assume that it will not cause a transaction to roll back even though by default an application exception will not cause a transaction to rollback.
If you like our products and services, please help us by posting your review here.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.462 :
With regard to this post, even though we set the query's flushModeType = AUTO, the query can "see" the changes in the pending transaction, but the query still cannot see the latest update in the database itself.Option "Retrieve the entity again using a query" is marked as wrong and explanation says : "JPA specification does not specify what happens to a managed entity if it is included in a result of a query. In many cases, the entity manager does not refresh the existing entity in the persistence context."
But on other hand JPA specification says that result of the query (in case of FlushModeType.AUTO) shall reflect current state, and should not return stale data.
Correct me if I am wrong.
Who is online
Users browsing this forum: No registered users and 36 guests