-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
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
Obtaining @Version value #74
Comments
@glassfishrobot Commented |
@glassfishrobot Commented Justification: To answer conditional HTTP requests it would be great to query the cache for a particular version. If the cache does not contain that version, EM shall NOT load from disk, but answer to JAX-RS or Servlet that this entity is not there. |
@glassfishrobot Commented
PS: Caching is supported now by JPA 2.0 @Cacheable; this should alleviate your concern about always materializing an entity. |
@glassfishrobot Commented Also my proposal will work with ANY entity – even entities that the caller has no source code of, hence, cannot add the proposed interface! @Cacheable actually does not solve the described use case. I do want to load from disk exactly in case the ETag is not matching. @Cacheable(false) prevents this. |
@glassfishrobot Commented |
@glassfishrobot Commented BTW, we do not see that the @Version member implicitly has to be public, as we do not want to access the member. We only want to either ask the EM to expose the version value, or even better, simply ask whether a known version still is current or not. |
@glassfishrobot Commented |
@glassfishrobot Commented |
|
Shouldn't a |
This is a reasonable-enough request, and there's been some low-level activity on this issue, so check out #451. |
I want to suggest that a future release of the JPA API provides a means to get the value of an entities version attribute.
Example: em.getVersion(myEntity);
he
Justification: Generic frameworks like JAX-RS or Servlets might have an interest in getting the value of the version attribute without "knowing" which is "the version attribute" for any particular entity. For example, JAX-RS or Servlets want to send a ETag header to a client for any entity, but the Servlet does not "know" the class of that entity. Like when class name and primary key value are provided by a HTTP request. In that case, a solution would be em.getVersion(myEntity) which just should return the value of the version.
The text was updated successfully, but these errors were encountered: