let a handwritten metamodel "override" the generated one

used in the JD TCK (ffff)

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-03-28 23:31:10 +01:00 committed by Christian Beikov
parent e829a01aee
commit 108374d4f0
1 changed files with 7 additions and 2 deletions

View File

@ -485,9 +485,14 @@ public class HibernateProcessor extends AbstractProcessor {
if ( context.generateJakartaDataStaticMetamodel()
// no static metamodel for embeddable classes in Jakarta Data
&& hasAnnotation( element, ENTITY, MAPPED_SUPERCLASS )
// Don't generate a Jakarta Data metamodel
// don't generate a Jakarta Data metamodel
// if this entity was partially mapped in XML
&& alreadyExistingMetaEntity == null ) {
&& alreadyExistingMetaEntity == null
// let a handwritten metamodel "override" the generated one
// (this is used in the Jakarta Data TCK)
&& element.getEnclosingElement().getEnclosedElements()
.stream().noneMatch(e -> e.getSimpleName()
.contentEquals('_' + element.getSimpleName().toString()))) {
final AnnotationMetaEntity dataMetaEntity =
AnnotationMetaEntity.create( typeElement, context,
requiresLazyMemberInitialization,