Hi, i work on a spring-boot project (version 2.3.8.RELEASE) with Hibernate (version 5.4.27.Final) and elasticsearch (spring-boot-starter-data-elasticsearch).
I want to enable bytecode enhancement lazy loading to increase performance of my @OneToOne relationships.
I added the hibernate-enhance-maven-plugin to my configuration following this Hibernate LazyToOne annotation article.
But when i start my application i got the following error stacktrace :
Caused by: java.lang.IllegalStateException: Expected to be able to resolve a type but got null! This usually stems from types implementing raw Map or Collection interfaces!
at org.springframework.data.util.TypeInformation.getRequiredActualType(TypeInformation.java:184)
at org.springframework.data.mapping.model.AbstractPersistentProperty.getActualType(AbstractPersistentProperty.java:286)
at org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchPersistentProperty.initDateConverter(SimpleElasticsearchPersistentProperty.java:122)
at org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchPersistentProperty.<init>(SimpleElasticsearchPersistentProperty.java:91)
at org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext.createPersistentProperty(SimpleElasticsearchMappingContext.java:53)
at org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext.createPersistentProperty(SimpleElasticsearchMappingContext.java:34)
at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:542)
at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:520)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:705)
at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:389)
at java.base/java.util.Collections$SingletonSet.forEach(Collections.java:4797)
at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:562)
at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:520)
...
If I remove all ElasticSearchRepositories of my application, it works normally and @LazyToOne fields are well lazy loaded.
Did you ever see anything like this ?