Hello.
Could not find out why this code does not work in Hibernate Search 6
@Indexed
@Entity
@Table(name = "asset2")
class Asset2 {
@Id
@Column(name = "id", length = 50)
String id;
@FullTextField
@Column(length = 500)
String name;
@GenericField
@Column(columnDefinition = "INT DEFAULT 0")
Integer nameIndex;
@Transient
@FullTextField
@IndexingDependency(
derivedFrom = @ObjectPath({
@PropertyValue(propertyName = "name"),
@PropertyValue(propertyName = "nameIndex")
})
)
String getFullName() {
return name = this.name + " " + getNameIndex();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getNameIndex() {
return nameIndex;
}
}
I’m getting
Hibernate ORM mapping:
type 'com.agronomeye.core.domain.assets.Asset2':
path '.fullName<no value extractors>':
failures:
- HSEARCH700078: No readable property named 'nameIndex' on type 'java.lang.String'
I found few examples here. But they were too complicated with another Bean. In my case I’m assuming that DefaultIntegerBridge will be applied for Integer field.
I also tried:
@Column(columnDefinition = "INT DEFAULT 0")
Integer nameIndex;
@GenericField
public String getNameIndex() {
return nameIndex.toString();
}
but still no success, the same error.
Thanks.