# HSEARCH700030: there is a cyclic dependency involving path (Bug ?)

**URL:** <https://discourse.hibernate.org/t/hsearch700030-there-is-a-cyclic-dependency-involving-path-bug/5701>\
**Category:** Hibernate Search\
**Created:** [September 13, 2021, 3:41pm UTC](https://discourse.hibernate.org/t/hsearch700030-there-is-a-cyclic-dependency-involving-path-bug/5701 "2021-09-13T15:41:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fraf](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/fraf/32/1614_2.png) [@fraf](https://discourse.hibernate.org/u/fraf)\
**Post date:** [September 13, 2021, 3:41pm UTC](https://discourse.hibernate.org/t/hsearch700030-there-is-a-cyclic-dependency-involving-path-bug/5701/1 "2021-09-13T15:41:45Z")

</div>

Hi everyone,

I discovered lastly a use case on Indexing mapping with HSearch. This example leads toward directly an error of indexation, which is :

> org.hibernate.search.util.common.SearchException: HSEARCH700030: Unable to resolve dependencies of a derived property: there is a cyclic dependency involving path ‘.typeActe’ on type ‘com.allegoria.notariat.business.ActePrive’. A derived properties cannot be marked as derived from itself, even indirectly through other derived properties. If your model actually contains such cyclic dependency, you should consider disabling automatic reindexing, at least partially using @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.NO) on one of the properties in the cycle.

Below the code causing this error :

```auto
@MappedSuperclass
public abstract class BasicActe extends BusinessObject implements ISearchableEntity {

@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type_acte_fk")
	protected TypeActe typeActe;

@IndexedEmbedded(includePaths = { TypeActe_.LIBELLE})
	@IndexingDependency(
			derivedFrom = {@ObjectPath({@PropertyValue(propertyName = Acte_.TYPE_ACTE)})}
	)
	public TypeActe getTypeActe() {
		return this.typeActe;
	}

public void setTypeActe(TypeActe typeActe) {
		this.typeActe = typeActe;
	}
}

```

And probably the code quoted in error message :

```auto
@XmlRootElement(name = "ActePrive")
@Entity
@Indexed
@PrimaryKeyJoinColumn(name = "ID")
@Inheritance(strategy = InheritanceType.JOINED)
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class ActePrive extends BasicActePrive implements HasRedacteur, ISearchableEntity {
...
}

```

The inheritance chain (not important) : ActePrive (child) → BasicActePrive → Acte → BasicActe (root)

I found a way to bypass this error :

```auto
@IndexedEmbedded(name ="IndexNameOfThisTypeActe", includePaths = { TypeActe_.LIBELLE})
	@IndexingDependency(
			derivedFrom = {@ObjectPath({@PropertyValue(propertyName = Acte_.TYPE_ACTE)})}
	)
	public TypeActe getTypeActe() {
		return this.typeActe;
	}

```

By simply adding `name ="IndexNameOfThisTypeActe"`. Where as this name is just for HSearch output (kind of Orm property alias) - or referenced by other indexed properties, it should not hide the error isn’t it ?

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [September 13, 2021, 3:46pm UTC](https://discourse.hibernate.org/t/hsearch700030-there-is-a-cyclic-dependency-involving-path-bug/5701/2 "2021-09-13T15:46:43Z")

</div>

Hello,

The solution is exactly what the error message is telling you. This code does not make sense:

> [@fraf](#):
>
> ```auto
> @IndexedEmbedded(includePaths = { TypeActe_.LIBELLE})
> @IndexingDependency(
> derivedFrom = {@ObjectPath({@PropertyValue(propertyName = Acte_.TYPE_ACTE)})}
> )
> public TypeActe getTypeActe() {
> return this.typeActe;
> }
> 
> ```

You’re telling Hibernate Search that `typeActe` is derived from `typeActe`. Evidently, the property is not computed from another property, so just remove `@IndexingDependency(derivedFrom = ...)` and it should work.

I recommend you have a look at [this section of the documentation](https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#mapper-orm-reindexing-derivedfrom) to understand how `derivedFrom` is used.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [September 13, 2021, 3:48pm UTC](https://discourse.hibernate.org/t/hsearch700030-there-is-a-cyclic-dependency-involving-path-bug/5701/3 "2021-09-13T15:48:07Z")

</div>

Regarding why the error is hidden by assigning a name to the `@IndexedEmbedded`… that’s odd, indeed. I will look into it.

---

<div class="post-metadata">

**Author:** ![fraf](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/fraf/32/1614_2.png) [@fraf](https://discourse.hibernate.org/u/fraf)\
**Post date:** [September 14, 2021, 7:40am UTC](https://discourse.hibernate.org/t/hsearch700030-there-is-a-cyclic-dependency-involving-path-bug/5701/4 "2021-09-14T07:40:42Z")

</div>

Hello,

I just tried another test on another (newly) indexed property, and appearently it is a false alarm. Forcing a name does not hide the error.
