Skip to content

Commit c979b9c

Browse files
committed
HHH-18620 - Add @NativeGenerator
1 parent bd4e438 commit c979b9c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorAnnotationHelper.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ public static <A extends Annotation> void prepareForUse(
305305
Consumer<Properties> configBaseline,
306306
BiConsumer<A,Properties> configExtractor,
307307
GeneratorCreationContext creationContext) {
308+
if ( generator instanceof AnnotationBasedGenerator ) {
309+
@SuppressWarnings("unchecked")
310+
final AnnotationBasedGenerator<A> generation = (AnnotationBasedGenerator<A>) generator;
311+
generation.initialize( annotation, idMember.toJavaMember(), creationContext );
312+
}
308313
if ( generator instanceof Configurable configurable ) {
309314
final Properties properties = new Properties();
310315
if ( configBaseline != null ) {
@@ -323,14 +328,6 @@ public static <A extends Annotation> void prepareForUse(
323328
}
324329
configurable.configure( creationContext, properties );
325330
}
326-
if ( generator instanceof AnnotationBasedGenerator ) {
327-
// This will cause a CCE in case the generation type doesn't match the annotation type; As this would be
328-
// a programming error of the generation type developer and thus should show up during testing, we don't
329-
// check this explicitly; If required, this could be done e.g. using ClassMate
330-
@SuppressWarnings("unchecked")
331-
final AnnotationBasedGenerator<A> generation = (AnnotationBasedGenerator<A>) generator;
332-
generation.initialize( annotation, idMember.toJavaMember(), creationContext );
333-
}
334331
if ( generator instanceof ExportableProducer exportableProducer ) {
335332
exportableProducer.registerExportables( creationContext.getDatabase() );
336333
}

0 commit comments

Comments
 (0)