@@ -175,7 +175,8 @@ public class AnnotationMetaEntity extends AnnotationMeta {
175
175
public AnnotationMetaEntity (
176
176
TypeElement element , Context context , boolean managed ,
177
177
boolean jakartaDataStaticMetamodel ,
178
- @ Nullable AnnotationMeta parent ) {
178
+ @ Nullable AnnotationMeta parent ,
179
+ @ Nullable TypeElement primaryEntity ) {
179
180
this .element = element ;
180
181
this .context = context ;
181
182
this .managed = managed ;
@@ -184,6 +185,7 @@ public AnnotationMetaEntity(
184
185
this .springInjection = context .isSpringInjection ();
185
186
this .importContext = parent != null ? parent : new ImportContextImpl ( getPackageName ( context , element ) );
186
187
jakartaDataStaticModel = jakartaDataStaticMetamodel ;
188
+ this .primaryEntity = primaryEntity ;
187
189
importContext .importType (
188
190
getGeneratedClassFullyQualifiedName ( element , getPackageName ( context , element ),
189
191
jakartaDataStaticModel ) );
@@ -192,17 +194,23 @@ public AnnotationMetaEntity(
192
194
}
193
195
}
194
196
197
+ public static AnnotationMetaEntity create (TypeElement element , Context context , @ Nullable AnnotationMetaEntity parent ,
198
+ @ Nullable TypeElement primaryEntity ) {
199
+ return create ( element ,context , false , false , false , parent , primaryEntity );
200
+ }
201
+
195
202
public static AnnotationMetaEntity create (TypeElement element , Context context , @ Nullable AnnotationMetaEntity parent ) {
196
- return create ( element ,context , false , false , false , parent );
203
+ return create ( element ,context , false , false , false , parent , null );
197
204
}
198
205
199
206
public static AnnotationMetaEntity create (
200
207
TypeElement element , Context context ,
201
208
boolean lazilyInitialised , boolean managed ,
202
209
boolean jakartaData ,
203
- @ Nullable AnnotationMetaEntity parent ) {
210
+ @ Nullable AnnotationMetaEntity parent ,
211
+ @ Nullable TypeElement primaryEntity ) {
204
212
final AnnotationMetaEntity annotationMetaEntity =
205
- new AnnotationMetaEntity ( element , context , managed , jakartaData , parent );
213
+ new AnnotationMetaEntity ( element , context , managed , jakartaData , parent , primaryEntity );
206
214
if ( parent != null ) {
207
215
parent .addInnerClass ( annotationMetaEntity );
208
216
}
@@ -419,8 +427,10 @@ else if ( method.getEnclosingElement().getKind().isInterface()
419
427
}
420
428
}
421
429
422
- primaryEntity = primaryEntity ( lifecycleMethods );
423
430
final boolean hibernateRepo = isExplicitlyHibernateRepository ();
431
+ if ( primaryEntity == null ) {
432
+ primaryEntity = primaryEntity ( lifecycleMethods );
433
+ }
424
434
if ( !checkEntity ( primaryEntity , hibernateRepo )
425
435
|| !checkEntities ( lifecycleMethods , hibernateRepo ) ) {
426
436
// NOTE EARLY EXIT with initialized = false
0 commit comments