# @IndexingDependency cannot detect properties of embedded custom class

**URL:** <https://discourse.hibernate.org/t/indexingdependency-cannot-detect-properties-of-embedded-custom-class/7162>\
**Category:** Hibernate Search\
**Created:** [January 19, 2023, 1:04am UTC](https://discourse.hibernate.org/t/indexingdependency-cannot-detect-properties-of-embedded-custom-class/7162 "2023-01-19T01:04:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![horvoje](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/horvoje/32/779_2.png) [@horvoje](https://discourse.hibernate.org/u/horvoje)\
**Post date:** [January 19, 2023, 1:04am UTC](https://discourse.hibernate.org/t/indexingdependency-cannot-detect-properties-of-embedded-custom-class/7162/1 "2023-01-19T01:04:44Z")

</div>

Hi!

Tried to add two paths into `derivedFrom`, but I get an error:

> org.hibernate.search.util.common.SearchException: HSEARCH700078:  
> No readable property named ‘parent.name’ on type ‘com.thevegcat.app.entities.provider.Provider’.

What is the syntax to put a reference to `name` property of `parent` property?  
I see there is additional `extraction` property of `@PropertyValue` on top of `propertyName`, but I can’t find how to use it.

```auto
@Entity @Indexed 
class Provider {

	@FullTextField
	private LocalizedField name;

	@ManyToOne( fetch = FetchType.LAZY )
	private Priovider parent;

	@Transient
	@IndexingDependency( derivedFrom = {
		@ObjectPath(@PropertyValue(propertyName = "name")),
		@ObjectPath(@PropertyValue(propertyName = "parent.name"))
	} )
	@KeywordField(name = "sortableTitle", projectable = Projectable.NO,
		searchable = Searchable.NO, sortable = Sortable.YES)
	public String getSortableTitle() {
		String name = this.name.get(LocaleUtil.SORT_LOCALE);
		if (this.parent == null) { return name; }
		return this.parent.name.get(LocaleUtil.SORT_LOCALE) + '.' + name;
	}

}

```

---

<div class="post-metadata">

**Author:** ![horvoje](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/horvoje/32/779_2.png) [@horvoje](https://discourse.hibernate.org/u/horvoje)\
**Post date:** [January 19, 2023, 2:12am UTC](https://discourse.hibernate.org/t/indexingdependency-cannot-detect-properties-of-embedded-custom-class/7162/2 "2023-01-19T02:12:25Z")

</div>

The right syntax is:

```auto
@IndexingDependency(derivedFrom = {
		@ObjectPath(@PropertyValue(propertyName = "name")),
		@ObjectPath({
			@PropertyValue(propertyName = "parent"),
			@PropertyValue(propertyName = "name")
		})
	})

```

Found it here:  
[spring - Index HashMap using keys as fields names. HibernateSearch - Stack Overflow](https://stackoverflow.com/questions/68532341/index-hashmap-using-keys-as-fields-names-hibernatesearch)

@yrodiere Maybe to put similar example into Reference Documentation because it’s not so intuitive to guess?

---

<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:** [January 19, 2023, 7:56am UTC](https://discourse.hibernate.org/t/indexingdependency-cannot-detect-properties-of-embedded-custom-class/7162/3 "2023-01-19T07:56:24Z")

</div>

> [@horvoje](#):
>
> @yrodiere Maybe to put similar example into Reference Documentation because it’s not so intuitive to guess?

I doubt that will cut it. What we need is a better syntax: [[HSEARCH-4392] - Hibernate JIRA](https://hibernate.atlassian.net/browse/HSEARCH-4392)
