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
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  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 | 10 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

    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