Repository navigation
Conversation
Set class_ to the managed type and skip constants and fields that are not attributes. Keep the first of two named query or mapping constants with the same name in the annotation processor. Generated-by: Claude Code (Opus 5.5)
rzo1
marked this pull request as ready for review
December 4, 2026 06:32
solomax
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/OPENJPA-3107
Since 4.2.0 (OPENJPA-2940) the annotation processor generates the JPA 3.2 field
public static volatile EntityType<Foo> class_;(orMappedSuperclassType/EmbeddableType) in every canonical metamodel class.MetamodelImpl.populate()treated it as an attribute and failed withmeta-field-less-param, so any persistence unit with a generated metamodel failed on the firstgetCriteriaBuilder()/getMetamodel().MetamodelImpl.populate():class_is set to the managed type. For a class that is both an entity and an embeddable, the embeddable type is used if the field can hold it, otherwise the entity type.static finalconstants (QUERY_,MAPPING_) and fields that are not attributes, such as theTypedQueryReferenceandEntityGraphfields other generators emit, are skipped.ClassCastException.AnnotationProcessor6(also from OPENJPA-2940):Coll.byNameandColl.byname) failed the generation of the whole class. The first one is kept and a warning is logged.Tests (
persistence/meta/constants): the_classes are the exact processor output, andmetamodelMatchesProcessorOutputrunsAnnotationProcessor6and compares its output with them. Covered: entity, mapped superclass, embeddable, a class that is entity and embeddable, inherited metamodel classes, named query and mapping constants, a Criteria query throughclass_, a Hibernate 7 style metamodel, wrongclass_types and mismatching fields. 11 of 12 fail on master.