rzo1 opened a new pull request, #337:
URL: https://github.com/apache/openjpa/pull/337

   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_;` (or 
`MappedSuperclassType` / `EmbeddableType`) in every canonical metamodel class. 
`MetamodelImpl.populate()` treated it as an attribute and failed with 
`meta-field-less-param`, so any persistence unit with a generated metamodel 
failed on the first `getCriteriaBuilder()` / `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 final` constants (`QUERY_`, `MAPPING_`) and fields that are not 
attributes, such as the `TypedQueryReference` and `EntityGraph` fields other 
generators emit, are skipped.
   - The error message for a mismatching field names that field and its own 
type; it no longer fails with an NPE or reports the previous field. Wildcard 
types are printed instead of failing with a `ClassCastException`.
   
   `AnnotationProcessor6` (also from OPENJPA-2940):
   - Query or mapping names that map to the same constant name (e.g. 
`Coll.byName` and `Coll.byname`) failed the generation of the whole class. The 
first one is kept and a warning is logged.
   - Constant values are written as escaped Java string literals.
   
   Tests (`persistence/meta/constants`): the `_` classes are the exact 
processor output, and `metamodelMatchesProcessorOutput` runs 
`AnnotationProcessor6` and 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 through 
`class_`, a Hibernate 7 style metamodel, wrong `class_` types and mismatching 
fields. 11 of 12 fail on master.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to