-
Notifications
You must be signed in to change notification settings - Fork 86
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
JpaMetamodelUtils can not find the version attribute if it is in a @MappedSuperclass #1818
Comments
Thanks for the report. Do you think you could quickly create a reproducer based on our quickstarts? This quickstart should give you a project template for that purpose: mvn archetype:generate "-DarchetypeGroupId=com.blazebit" "-DarchetypeArtifactId=blaze-persistence-archetype-entity-view-sample-jakarta" "-DarchetypeVersion=1.6.9" |
I managed to boil it down to a simple reproduction: https://github.com/kuhnroyal/blaze-problems/tree/main |
Thanks so much. Since you dug into this and think this could be a Hibernate ORM issue, would you mind trying to see if you can reproduce an error with just Hibernate ORM? |
I added a plain |
This is great, thanks for your efforts. Would be awesome if you could create a Hibernate Jira issue so you can also track the efforts for that bug. Also, if you create the issue, please share the link here for cross reference. |
Thanks for creating the Jira. I'll try to fix it in Hibernate ORM as soon as possible. |
Description
I have a
version
attribute in a@MappedSuperclass
but when the EntityView for this class is analyzed, theJpaMetamodelUtils.getVersionAttribute
returns null here: https://github.com/Blazebit/blaze-persistence/blob/main/core/parser/src/main/java/com/blazebit/persistence/parser/util/JpaMetamodelUtils.java#L398The attribute is there but it can not be found by iterating over
entityType.getSingularAttributes()
.I manually changed the return statement to
return entityType.getVersion(Long.class);
which succeeds, obviously that only works because I know the type of the field.Not sure if this only happens with Hibernate 6.2 - I didn't use Blaze before.
Expected behavior
I expect that the version attribute is found so that optimistic locking can be used.
Actual behavior
The version attribute is not found and optimistic locking is disabled.
Steps to reproduce
I will see if I can add that later.
Environment
Version: 1.6.9
JPA-Provider: Hibernate 6.2.13.Final
DBMS: PostgreSQL
Application Server: Java/Spring 6
The text was updated successfully, but these errors were encountered: