From e4e1b59a1d3553e5822552bb83dc2767fb14249d Mon Sep 17 00:00:00 2001 From: Gavin King Date: Thu, 5 Dec 2024 12:12:39 +0100 Subject: [PATCH] HHH-18863 allow index creation to be disabled in processor also cache enum results read from index --- .../java/org/hibernate/processor/HibernateProcessor.java | 2 +- .../processor/validation/ProcessorSessionFactory.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java index 57770f1c31..1dd4c9cf75 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java @@ -291,7 +291,7 @@ public class HibernateProcessor extends AbstractProcessor { context.setInclude( options.getOrDefault( INCLUDE, "*" ) ); context.setExclude( options.getOrDefault( EXCLUDE, "" ) ); - context.setIndexing( parseBoolean( options.get( INDEX ) ) ); + context.setIndexing( parseBoolean( options.getOrDefault( INDEX, "true" ) ) ); return parseBoolean( options.get( FULLY_ANNOTATION_CONFIGURED_OPTION ) ); } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java index 2b9afc1c5e..381b1ba924 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java @@ -134,7 +134,6 @@ public abstract class ProcessorSessionFactory extends MockSessionFactory { } } - @Override Type propertyType(String typeName, String propertyPath) { final TypeElement type = findClassByQualifiedName(typeName); @@ -226,8 +225,10 @@ public abstract class ProcessorSessionFactory extends MockSessionFactory { } if ( indexing ) { final Set indexed = getIndexedEnumTypesByValue(value); - enumTypesByValue.put(value, indexed); - return indexed; + if ( indexed != null ) { + enumTypesByValue.put(value, indexed); + return indexed; + } } //TODO: else do a full scan like in findEntityByUnqualifiedName() return null;