org.hibernate.search.exception.SearchException: Unable to find field sponsor.profile.tag.id in nl.project.model.social.WallPost

Hibernate JIRA | Marc Schipperheyn | 2 years ago
  1. 0

    So, this is an early report for which I'm not 100% what the underlying issue is, and I'm still having issues getting my environment up and running. But you guys asked for early reports, so here goes A number of my @IndexedEmbedded relations are being reported as non-existing in queries. For example {code} @DiscriminatorValue(value = "WPT") @ClassBridge(impl=WallPostClassBridge.class,index=org.hibernate.search.annotations.Index.YES,analyze=Analyze.NO,store=Store.NO) @Indexed(interceptor=WallPostIndexingInterceptor.class) public class WallPost extends BaseWallPost{ @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true,mappedBy="post", fetch=FetchType.LAZY) @IndexedEmbedded(prefix="sponsor.",indexNullAs=Field.DEFAULT_NULL_TOKEN) public List<SponsoredPost> getSponsored() { return sponsored; } } {code} {code} @Entity @Table(name="SponsoredPost") public class SponsoredPost{ @OneToOne(cascade=CascadeType.ALL,optional=false,fetch=FetchType.EAGER) @JoinColumn(name="FK_TargetProfileId", nullable=false, updatable=false) @IndexedEmbedded(prefix="profile.") @NotNull public TargetProfile getProfile() { return profile; } } {code} {code} Entity @Table(name="TargetProfile") public class TargetProfile{ @ManyToMany(fetch=FetchType.LAZY) @JoinTable(name="TargetProfile_Tags" ,joinColumns=@JoinColumn(name="targetProfileId") ,inverseJoinColumns=@JoinColumn(name="tagId") ) @IndexedEmbedded(prefix="tag.") public Set<Tag> getTags() { return tags; } } {code} The exception I'm seeing is: {code} org.hibernate.search.exception.SearchException: Unable to find field sponsor.profile.tag.id in nl.project.model.social.WallPost at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.objectToString(DocumentBuilderIndexedEntity.java:674) at org.hibernate.search.query.dsl.impl.FieldContext.objectToString(FieldContext.java:69) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm(ConnectedMultiFieldsTermQueryBuilder.java:129) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:83) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:64) at nl.project.dao.hibernate.WallDaoHibernate.getSponsoredPosts(WallDaoHibernate.java:2367) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) at com.sun.proxy.$Proxy173.getSponsoredPosts(Unknown Source) at nl.project.integration.SponsoredPostTest.testSponsoredPostInvalid(SponsoredPostTest.java:477) {code}

    Hibernate JIRA | 2 years ago | Marc Schipperheyn
    org.hibernate.search.exception.SearchException: Unable to find field sponsor.profile.tag.id in nl.project.model.social.WallPost
  2. 0

    So, this is an early report for which I'm not 100% what the underlying issue is, and I'm still having issues getting my environment up and running. But you guys asked for early reports, so here goes A number of my @IndexedEmbedded relations are being reported as non-existing in queries. For example {code} @DiscriminatorValue(value = "WPT") @ClassBridge(impl=WallPostClassBridge.class,index=org.hibernate.search.annotations.Index.YES,analyze=Analyze.NO,store=Store.NO) @Indexed(interceptor=WallPostIndexingInterceptor.class) public class WallPost extends BaseWallPost{ @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true,mappedBy="post", fetch=FetchType.LAZY) @IndexedEmbedded(prefix="sponsor.",indexNullAs=Field.DEFAULT_NULL_TOKEN) public List<SponsoredPost> getSponsored() { return sponsored; } } {code} {code} @Entity @Table(name="SponsoredPost") public class SponsoredPost{ @OneToOne(cascade=CascadeType.ALL,optional=false,fetch=FetchType.EAGER) @JoinColumn(name="FK_TargetProfileId", nullable=false, updatable=false) @IndexedEmbedded(prefix="profile.") @NotNull public TargetProfile getProfile() { return profile; } } {code} {code} Entity @Table(name="TargetProfile") public class TargetProfile{ @ManyToMany(fetch=FetchType.LAZY) @JoinTable(name="TargetProfile_Tags" ,joinColumns=@JoinColumn(name="targetProfileId") ,inverseJoinColumns=@JoinColumn(name="tagId") ) @IndexedEmbedded(prefix="tag.") public Set<Tag> getTags() { return tags; } } {code} The exception I'm seeing is: {code} org.hibernate.search.exception.SearchException: Unable to find field sponsor.profile.tag.id in nl.project.model.social.WallPost at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.objectToString(DocumentBuilderIndexedEntity.java:674) at org.hibernate.search.query.dsl.impl.FieldContext.objectToString(FieldContext.java:69) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm(ConnectedMultiFieldsTermQueryBuilder.java:129) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:83) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:64) at nl.project.dao.hibernate.WallDaoHibernate.getSponsoredPosts(WallDaoHibernate.java:2367) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) at com.sun.proxy.$Proxy173.getSponsoredPosts(Unknown Source) at nl.project.integration.SponsoredPostTest.testSponsoredPostInvalid(SponsoredPostTest.java:477) {code}

    Hibernate JIRA | 2 years ago | Marc Schipperheyn
    org.hibernate.search.exception.SearchException: Unable to find field sponsor.profile.tag.id in nl.project.model.social.WallPost
  3. 0

    Programmatic mapping with embedded index in Hibernate Search results in unable to find field error

    Stack Overflow | 7 months ago | Priya Gachinamath
    org.hibernate.search.exception.SearchException: Unable to find field arr in com....AT
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hi, From what I heard, from Hibernate Search 5 on, adding a @SortableField annotation is required to perform any kind of sort on a field. This seems to apply to id fields too, since I get warnings in the logs if I don't. Unfortunately, putting an @SortableField on an @Id/@DocumentId will make Hibernate Search initialization explode when an entity (say Level2) is referenced from another (say Level1) as an @IndexedEmbedded: when parsing annotations for Level1, the engine will find the @SortableField on the id field of Level2, but will not find the id field on Level2 ( ?). And crash, with this kind of error : {noformat} org.hibernate.search.exception.SearchException: HSEARCH000299: @SortableField declared on org.hibernate.search.test.embedded.sortablefield.Level2SortableId#id references to undeclared field 'level2Child.id' at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.bindSortableFieldAnnotation(AnnotationMetadataProvider.java:810) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.checkForSortableField(AnnotationMetadataProvider.java:1353) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:853) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.checkForIndexedEmbedded(AnnotationMetadataProvider.java:1584) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:857) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getTypeMetadataFor(AnnotationMetadataProvider.java:130) at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:373) at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199) at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117) at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75) at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:541) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) at org.hibernate.search.test.DefaultTestResourceManager.buildSessionFactory(DefaultTestResourceManager.java:108) at org.hibernate.search.test.DefaultTestResourceManager.openSessionFactory(DefaultTestResourceManager.java:76) at org.hibernate.search.test.SearchTestBase.setUp(SearchTestBase.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:41) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:26) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) {noformat} Adding an @Field annotation on Level2.id will not solve the issue, since it will crash another way (seems forbidden to add a field named exactly like the @Id field). {noformat} org.hibernate.search.exception.SearchException: HSEARCH000247: An indexed field defined on 'org.hibernate.search.test.embedded.sortablefield.Level2SortableId:id' tries to override the id field settings. The document id field settings cannot be modified. Use a different field name. at org.hibernate.search.engine.metadata.impl.TypeMetadata$Builder.addProperty(TypeMetadata.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:872) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getTypeMetadataFor(AnnotationMetadataProvider.java:130) at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:373) at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199) at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117) at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75) at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:541) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) at org.hibernate.search.test.DefaultTestResourceManager.buildSessionFactory(DefaultTestResourceManager.java:108) at org.hibernate.search.test.DefaultTestResourceManager.openSessionFactory(DefaultTestResourceManager.java:76) at org.hibernate.search.test.SearchTestBase.setUp(SearchTestBase.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:41) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:26) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) {noformat} Note that : * this is tied to indexing entities: when there is no @Id annotation on the "id" attribute, I can freely define an @Field on the "id" attribute, and everything works fine. * this will happen regardless of whether the id field is part of the @IndexedEmbedded or not. I see two workarounds at the moment: * refraining from adding the @SortField annotation (this works, after all) * defining a separate @Field (named "idSort", for instance) just for sorting

    Hibernate JIRA | 1 year ago | Yoann Rodière
    org.hibernate.search.exception.SearchException: HSEARCH000247: An indexed field defined on 'org.hibernate.search.test.embedded.sortablefield.Level2SortableId:id' tries to override the id field settings. The document id field settings cannot be modified. Use a different field name.
  6. 0

    Hi, From what I heard, from Hibernate Search 5 on, adding a @SortableField annotation is required to perform any kind of sort on a field. This seems to apply to id fields too, since I get warnings in the logs if I don't. Unfortunately, putting an @SortableField on an @Id/@DocumentId will make Hibernate Search initialization explode when an entity (say Level2) is referenced from another (say Level1) as an @IndexedEmbedded: when parsing annotations for Level1, the engine will find the @SortableField on the id field of Level2, but will not find the id field on Level2 ( ?). And crash, with this kind of error : {noformat} org.hibernate.search.exception.SearchException: HSEARCH000299: @SortableField declared on org.hibernate.search.test.embedded.sortablefield.Level2SortableId#id references to undeclared field 'level2Child.id' at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.bindSortableFieldAnnotation(AnnotationMetadataProvider.java:810) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.checkForSortableField(AnnotationMetadataProvider.java:1353) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:853) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.checkForIndexedEmbedded(AnnotationMetadataProvider.java:1584) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:857) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getTypeMetadataFor(AnnotationMetadataProvider.java:130) at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:373) at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199) at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117) at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75) at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:541) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) at org.hibernate.search.test.DefaultTestResourceManager.buildSessionFactory(DefaultTestResourceManager.java:108) at org.hibernate.search.test.DefaultTestResourceManager.openSessionFactory(DefaultTestResourceManager.java:76) at org.hibernate.search.test.SearchTestBase.setUp(SearchTestBase.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:41) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:26) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) {noformat} Adding an @Field annotation on Level2.id will not solve the issue, since it will crash another way (seems forbidden to add a field named exactly like the @Id field). {noformat} org.hibernate.search.exception.SearchException: HSEARCH000247: An indexed field defined on 'org.hibernate.search.test.embedded.sortablefield.Level2SortableId:id' tries to override the id field settings. The document id field settings cannot be modified. Use a different field name. at org.hibernate.search.engine.metadata.impl.TypeMetadata$Builder.addProperty(TypeMetadata.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:872) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:469) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getTypeMetadataFor(AnnotationMetadataProvider.java:130) at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:373) at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199) at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117) at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75) at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:541) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) at org.hibernate.search.test.DefaultTestResourceManager.buildSessionFactory(DefaultTestResourceManager.java:108) at org.hibernate.search.test.DefaultTestResourceManager.openSessionFactory(DefaultTestResourceManager.java:76) at org.hibernate.search.test.SearchTestBase.setUp(SearchTestBase.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:41) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:26) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) {noformat} Note that : * this is tied to indexing entities: when there is no @Id annotation on the "id" attribute, I can freely define an @Field on the "id" attribute, and everything works fine. * this will happen regardless of whether the id field is part of the @IndexedEmbedded or not. I see two workarounds at the moment: * refraining from adding the @SortField annotation (this works, after all) * defining a separate @Field (named "idSort", for instance) just for sorting

    Hibernate JIRA | 1 year ago | Yoann Rodière
    org.hibernate.search.exception.SearchException: HSEARCH000247: An indexed field defined on 'org.hibernate.search.test.embedded.sortablefield.Level2SortableId:id' tries to override the id field settings. The document id field settings cannot be modified. Use a different field name.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.search.exception.SearchException

      Unable to find field sponsor.profile.tag.id in nl.project.model.social.WallPost

      at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.objectToString()
    2. Hibernate Search Engine
      ConnectedMultiFieldsTermQueryBuilder.createQuery
      1. org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.objectToString(DocumentBuilderIndexedEntity.java:674)
      2. org.hibernate.search.query.dsl.impl.FieldContext.objectToString(FieldContext.java:69)
      3. org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm(ConnectedMultiFieldsTermQueryBuilder.java:129)
      4. org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:83)
      5. org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:64)
      5 frames
    3. nl.project.dao
      WallDaoHibernate.getSponsoredPosts
      1. nl.project.dao.hibernate.WallDaoHibernate.getSponsoredPosts(WallDaoHibernate.java:2367)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    5. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
      2 frames
    6. com.sun.proxy
      $Proxy173.getSponsoredPosts
      1. com.sun.proxy.$Proxy173.getSponsoredPosts(Unknown Source)
      1 frame
    7. nl.project.integration
      SponsoredPostTest.testSponsoredPostInvalid
      1. nl.project.integration.SponsoredPostTest.testSponsoredPostInvalid(SponsoredPostTest.java:477)
      1 frame