Hibernate Search 6 migration issue: Unable to find the inverse side of the association on type ()

Hello,

I migrated to hibernate search 6 and elastic server 7.10.0. As part of the migration I removed the @ContainedIn annotation and only used the @IndexedEmbedded annotation for the owner To class . But on bootstrap I get below error and need help in identifying the correct way to resolve this.

  Hibernate ORM mapping: 
        type 'com.csc.pt.svc.data.to.Basclt0900TO': 
            path '.basclt0100toList<collection>.agentnum<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. 
`Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).

I get this for all the fields in basclt0100toList and basclt0300toList

BASCLT0900TO class :

@Entity
@Indexed(index="master_client_index")

public class Basclt0900TO  {
	
	private DBAccessStatus dBAccessStatus;
	@OneToMany(mappedBy = "basclt0900TO")
	@IndexedEmbedded
	private Set<Basclt0300TO> basclt0300toList = new HashSet<>();
	@OneToMany(mappedBy = "basclt0900TO")
	@IndexedEmbedded
    private Set<Basclt0100TO> basclt0100toList = new HashSet<>();

BASCLT0100 class:

@Entity
@Indexed(index="client_0100")


public class Basclt0100TO  {
	//@ContainedIn ------ **earlier we had contained in on this class , but replaced with below code**
	  @AssociationInverseSide( 
	            inversePath = @ObjectPath( @PropertyValue( propertyName = "basclt0100TO" ) )
	    )
private Basclt0900TO basclt0900to;

Basclt0300 class:



@Entity
@Indexed(index="client_0300")

public class Basclt0300TO {
	private DBAccessStatus dBAccessStatus;
	//@ContainedIn
	  @AssociationInverseSide( 
	            inversePath = @ObjectPath( @PropertyValue( propertyName = "basclt0900TO" ) )
	    )
private Basclt0900TO basclt0900to;

Below is how we had the mapping in our BASCLT0900 hbm file :

 <set name="basclt0300toList" table="BASCLT0300" inverse="true">
            <key>
                <column name="CLTSEQNUM" not-null="true" />
            </key>
            <one-to-many class="com.csc.pt.svc.data.to.Basclt0300TO" />
        </set>
        
           <set name="basclt0100toList" table="BASCLT0100" inverse="true">
            <key>
                <column name="CLTSEQNUM" not-null="true" />
            </key>
            <one-to-many class="com.csc.pt.svc.data.to.Basclt0100TO" />
        </set>

Below the index structure we had earlier :

     {
        "_index" : "master_client_index",
        "_type" : "com.csc.pt.svc.data.to.Basclt0900TO",
        "_id" : "3349",
        "_score" : 1.0,
        "_source" : {
          "id" : "3349",
          "cltseqnum" : 3349,
          "basclt0300toList" : [
            {
              "addrseqnum" : "1",
              "cltseqnum" : 3349,
              "addrtype" : "PRIMARY",
              "addrln1" : "1000 Main St",
              "city" : "Columbia",
              "state" : "SC",
              "zipcode" : "29501",
              "country" : "USA"
            }
          ],
          "basclt0100toList" : [
            {
              "cltseqnum" : 3349,
              "nameType" : "B",
              "longname" : "Bank Of West",
              "phone1" : "1115556985"
            }
          ]
        }
      },

Hello,

I’m sorry, but your post is so badly formatted that I can’t understand it. Please format code properly, like so:

Here is some non-code text.

Below is some code, properly wrapped with ```:

```
@Entity
public MyClass {

    private String myProperty;

}
```

@yrodiere sorry for that , I hit enter before I could format it , please check now

Your @AssociationInverseSide annotations are:

  1. Incorrect. For example in one place you used propertyName = "basclt0100TO" but the property name is actually basclt0100toList.
  2. Unnecessary. You don’t need to use @AssociationInverseSide when you already specify the inverse side of associations in Hibernate ORM with mappedBy = ....

Try removing the @AssociationInverseSide annotations.

Also, make sure to fix your JPA mapping:

  • add the missing @ManyToOne annotations in Basclt0100TO/Basclt0300TO (I suppose they are already there and you removed them, but who knows)
  • fix the mappedBy in Basclt0900TO; you set them to basclt0900TO, but the actual name of the properties is basclt0900to (to, not TO).
@Entity
@Indexed(index="master_client_index")

public class Basclt0900TO  {
	
	private DBAccessStatus dBAccessStatus;
	@OneToMany(mappedBy = "basclt0900to")
	@IndexedEmbedded
	private Set<Basclt0300TO> basclt0300toList = new HashSet<>();
	@OneToMany(mappedBy = "basclt0900to")
	@IndexedEmbedded
    private Set<Basclt0100TO> basclt0100toList = new HashSet<>();
@Entity
@Indexed(index="client_0100")


public class Basclt0100TO  {
	//@ContainedIn ------ **earlier we had contained in on this class , but replaced with below code**
@ManyToOne
private Basclt0900TO basclt0900to;
}
@Entity
@Indexed(index="client_0300")

public class Basclt0300TO {
	private DBAccessStatus dBAccessStatus;
	//@ContainedIn
@ManyToOne
private Basclt0900TO basclt0900to;

I removed the @AssociationInverseSide annotations and corrected the JPA mappings. I did not have the @ManytoOne annotations but the TO ( not to ) was a copy paste error.

I am still getting below error:

org.hibernate.search.util.common.SearchException: HSEARCH000520: Hibernate Search encountered failures during bootstrap. Failures:

    Hibernate ORM mapping: 
        type 'com.csc.pt.svc.data.to.Basclt0900TO': 
            path '.basclt0100toList<collection>.agentnum<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0100toList<collection>.longname<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0100toList<collection>.midname<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0100toList<collection>.nametype<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0100toList<collection>.phone1<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.addrln1<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.addrln2<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.addrln3<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.addrln4<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.addrtype<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.city<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.country<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.state<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0300toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified. You can solve this error by defining the inverse side of this association,  either with annotations specific to your integration (@OneToMany(mappedBy = ...) in Hibernate ORM)  or with the Hibernate Search @AssociationInverseSide annotation. Alternatively, if you do not need to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0300TO' is modified, you can disable automatic reindexing with @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW).
            path '.basclt0300toList<collection>.zipcode<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO

Basclt0100 class :

@Entity
@Indexed(index="client_0100")


public class Basclt0100TO  {

	 @ManyToOne
	private Basclt0900TO basclt0900to;
	private DBAccessStatus dBAccessStatus;
	private String groupno = "";
	@GenericField(searchable=Searchable.YES, projectable = Projectable.YES, name="nameType")
	private char nametype;
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="midname")
	private String midname = "";
	@FullTextField(searchable=Searchable.YES,projectable = Projectable.YES,name = "agentnum")
	private String agentnum = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="longname",analyzer = "nameKeywordAnalyzer")
	private String longname = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="phone1",analyzer = "alphaNumericAnalyzer")
	private String phone1 = "";
	private String phone2 = "";
	private String fedtaxid = "";

Basclt0300 class:

@Entity
@Indexed(index="client_0300")

public class Basclt0300TO {
	private DBAccessStatus dBAccessStatus;
	 @ManyToOne
	  private Basclt0900TO basclt0900to;
	

	public Basclt0900TO getBasclt0900to() {
		return basclt0900to;
	}

	public void setBasclt0900to(Basclt0900TO basclt0900to) {
		this.basclt0900to = basclt0900to;
	}

	private char addrstatus;
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrtype",analyzer = "nameAnalyzer")
	private String addrtype = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln1",analyzer = "nameAnalyzer")
	private String addrln1 = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln2",analyzer = "nameAnalyzer")
	private String addrln2 = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln3",analyzer = "nameAnalyzer")
	private String addrln3 = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln4",analyzer = "nameAnalyzer")
	private String addrln4 = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="city",analyzer = "nameAnalyzer")
	private String city = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="state")
	private String state = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="zipcode",analyzer = "alphaNumericAnalyzer")
	private String zipcode = "";
	@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="country",analyzer = "addressAnalyzer")
	private String country = "";

Basclt1400:

@Entity
@Indexed(index="master_client_index")

public class Basclt0900TO  {
	
	private DBAccessStatus dBAccessStatus;
	@OneToMany(mappedBy = "basclt0900to")
	@IndexedEmbedded
	private Set<Basclt0300TO> basclt0300toList = new HashSet<>();
	@OneToMany(mappedBy = "basclt0900to")
	@IndexedEmbedded
    private Set<Basclt0100TO> basclt0100toList = new HashSet<>();

I don’t think the problem is visible in the snippets you gave; you probably removed something else that is causing the issue. At least I don’t see any obvious problem.

Please provide a reproducer based on the test case template; then I should be able to help.

In response to your private messages… If copying your classes in the test case template won’t reproduce the problem, I’m afraid showing them to me won’t help. The problem must be something else.

Maybe you have some kind of post-processing in your app that you didn’t include in the reproducer? Maybe some hbm files that you didn’t include in the reproducer? Some persistence.xml or JPA properties?

My advice is: copy to the test case template everything that seems even remotely related to the problematic classes, then see if it reproduces the problem. If so, remove everything you want to, as long as the problem remains. If not, add more of your app until the problem shows up.

I think I found the issue, but not sure why these are causing problems. I had the fields of BASCLT0100 and BASCLT0300 annotated like below , and if I commented these annotations those inverse mapping exceptions on bootstrap were gone.
these are those annotations :
BASCLT0100:

@Entity
@Indexed(index="client_0100")


public class Basclt0100TO  {
	 @ManyToOne(targetEntity = Basclt0900TO.class)
	 @JoinColumn(name = "CLTSEQNUM", referencedColumnName = "CLTSEQNUM")
	private Basclt0900TO basclt0900to1;
	private DBAccessStatus dBAccessStatus;
	private String groupno = "";
	//@GenericField(searchable=Searchable.YES, projectable = Projectable.YES, name="nameType")
	private char nametype;
	private char namestatus;
	private String clientname = "";
	private String firstname = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="midname")
	private String midname = "";
	private String prefixnm = "";
	private String suffixnm = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="longname",analyzer = "nameKeywordAnalyzer")
	private String longname = "";
	private String dba = "";
	private String contact = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="phone1",analyzer = "alphaNumericAnalyzer")

	public String getPhone1() {
		return this.phone1;
	}

	public void setPhone1(String phone1) {
		this.phone1 = phone1;
	}
	public String getLongname() {
		return this.longname;
	}

	public void setLongname(String longname) {
		this.longname = longname;
	}

BASCLT0300:


@Entity
@Indexed(index="client_0300")

public class Basclt0300TO {
	private DBAccessStatus dBAccessStatus;
	 @ManyToOne //(targetEntity =Basclt0900TO.class)
	 @JoinColumn(name = "CLTSEQNUM", referencedColumnName = "CLTSEQNUM")
	  private Basclt0900TO basclt0900to1;
	public Basclt0900TO getBasclt0900to1() {
		return basclt0900to1;
	}

	public void setBasclt0900to1(Basclt0900TO basclt0900to1) {
		this.basclt0900to1 = basclt0900to1;
	}

	private char addrstatus;
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrtype",analyzer = "nameAnalyzer")
	private String addrtype = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln1",analyzer = "nameAnalyzer")
	private String addrln1 = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln2",analyzer = "nameAnalyzer")
	private String addrln2 = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln3",analyzer = "nameAnalyzer")
	private String addrln3 = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="addrln4",analyzer = "nameAnalyzer")
	private String addrln4 = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="city",analyzer = "nameAnalyzer")
	private String city = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="state")
	private String state = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="zipcode",analyzer = "alphaNumericAnalyzer")
	private String zipcode = "";
	//@FullTextField(searchable=Searchable.YES, projectable = Projectable.YES, name="country",analyzer = "addressAnalyzer")
	private String country = "";
	public String getZipcode() {
		return this.zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	public String getCountry() {
		return this.country;
	}

	public void setCountry(String country) {
		this.country = country;
	}


Similar getters and setters for all the fields.

Not sure why these give me below error:

        type 'com.csc.pt.svc.data.to.Basclt0900TO': 
            path '.basclt0100toList<collection>.agentnum<no value extractors>': 
                failures: 
                  - HSEARCH700020: Unable to find the inverse side of the association on type 'com.csc.pt.svc.data.to.Basclt0900TO' at path '.basclt0100toList<collection>'. Hibernate Search needs this information in order to reindex 'com.csc.pt.svc.data.to.Basclt0900TO' when 'com.csc.pt.svc.data.to.Basclt0100TO' is modified.

As the error message is telling you:

If you don’t index anything in Basclt0100TO, then Hibernate Search doesn’t care when it gets modified, and thus it won’t complain about not knowing about the inverse path of this association: it becomes irrelevant.

So yes, removing the field annotation gets rid of the problem, but I’m afraid that doesn’t help.

Out of curiosity, which version of Hibernate ORM are you using?

yes , it doesn’t help . Just removes the errors and I get the old index structure back . I think I will have to provide some type of IndexingDependency to let hibernate know how I want them to be reindexed. I have set below for now .

@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.NO)

Below are the versions I am using:

If you do that, Hibernate Search will not reindex. Hibernate Search already knows how to reindex your fields; it’s complaining that it cannot find a path from Basclt0100TO back to Basclt0900TO in order to actually perform reindexing.

It should find that path, though, because you defined the mappedBy on your association. There is something in your setup that is preventing Hibernate Search from understanding the mapping. What it is, I don’t know, but I know it’s not part of what you showed. And you know it too, since you tried to put this code in a new project and the problem disappeared. So there’s something else.

Browsing through past topics, I found a coworker of yours also having mapping problems with these Basclt classes: Lazy initialization exception on mass indexing/intial indexing - #2 by yrodiere . So I suspect there’s something highly unusual in your application; you need to find what it is in order to solve the problem.

Your @AssociationInverseSide annotations are:

  1. Unnecessary. You don’t need to use @AssociationInverseSide when you already specify the inverse side of associations in Hibernate ORM with mappedBy = ... .

Can you explain why the @AssociationInverseSide is necessary in my case :

@Entity
@Indexed
public class Depot extends BasicDepot implements IArchivable {

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "bureau_hypotheque_fk")
  protected BureauHypotheque bureauHypotheque;

  @IndexedEmbedded(includePaths = { DepotIndexed_.BUREAU_HYPOTHEQUE_NOM_COMPLET, 
  DepotIndexed_.BUREAU_HYPOTHEQUE_ID	})
	public BureauHypotheque getBureauHypotheque() {
		return this.bureauHypotheque;
	}
}
@Entity
public class BureauHypotheque extends BasicBureauHypotheque {

    @OneToMany(mappedBy = Depot_.BUREAU_HYPOTHEQUE)
	protected transient Set<Depot> actesPrives = new HashSet<>();

    public Set<Depot> getActesPrives() {
		return actesPrives;
	}

	public void setActesPrives(Set<Depot> actesPrives) {
		this.actesPrives = actesPrives;
	}

}

I need to add the annotation like this :

@AssociationInverseSide(inversePath = @ObjectPath(@PropertyValue(propertyName = "actesPrives")))
@IndexedEmbedded(includePaths = { DepotIndexed_.BUREAU_HYPOTHEQUE_NOM_COMPLET, DepotIndexed_.BUREAU_HYPOTHEQUE_ID	})
	public BureauHypotheque getBureauHypotheque() {
		return this.bureauHypotheque;
	}

I cannot explain why it’s necessary: it shouldn’t be necessary. Hibernate Search 6 is able to understand mappedBy, and as far as I can tell it does understand it in all the other applications using Hibernate Search 6.

That’s why I’m saying there is something unique in your application. But I don’t know what it is, because I don’t know your application. If you can write a reproducer, I can help; otherwise I can’t.

@fraf If your application is a different one, then I would be very, very interested in a reproducer of this problem: hibernate-test-case-templates/search/hibernate-search-6/orm-elasticsearch at main · hibernate/hiberna

@fraf I managed to reproduce your problem by inferring the content of your Basic* classes. It seems Hibernate Search does not properly understand the mappedBy in some cases when there are superclasses; I’m still trying to figure out what’s the cause exactly. => Actually that’s wrong, it’s because of the transient keyword. See below.

In any case, thanks a lot for your snippets, they helped a lot.

@harpreetKaur If your classes have superclasses that you didn’t show in your snippets, then you might be affected by the same bug. => That’s wrong, see below.

Ok, false alarm: it’s actually because of the transient keyword… Hibernate ORM ignores transient fields, and thus your @OneToMany(mappedBy = Depot_.BUREAU_HYPOTHEQUE) annotation on BureauHypotheque.actesPrives (which is transient) is completely ignored.

This means Hibernate Search won’t know of the mappedBy, but more importantly this means actesPrives will always be null: Hibernate ORM does not keep track of this property in its metadata, so I don’t think it will ever populate this property. So reindexing will not work, even if you use @AssociationInverseSide, because at runtime actesPrives will not point to the instances of Depot that need reindexing.

You really should remove this transient keyword.

@harpreetKaur If you use a transient keyword in your properties, this is your problem. Otherwise, we need to keep looking…

@yrodiere thanks , but I dont have superclass for BASCLT0900 or use transient keyword in these properties. Still looking for the problem. It wouldnt index the classes I am trying to

Okay. But I thought transient java keyword is concerning Object’s serialization. Whereas Hibernate ORM is tracking @Transient annotation. Those two “transient” are distinct.

EDIT : I confirm that removing transient keyword make annotation @AssociationInverseSide unecessary.

I know they are distinct. I’m just telling you how Hibernate ORM behaves, not how I think it should behave. Regardless of what I think, Hibernate ORM is ignoring your @OneToMany annotation.

I think it’s been reported already: https://hibernate.atlassian.net/browse/HHH-13868