Migration hibernate search from 5.11 to 6.0.10 final

I am trying to migrate my project from hibernate search 5.11 to hibernate 6. It seems so difficult !
I have changed the dependencies on pom.xml.
My new dependencies are

<dependency>
	<groupId>org.hibernate.search</groupId>
	<artifactId>hibernate-search-v5migrationhelper-orm</artifactId>
	<version>6.0.10.Final</version>
</dependency>
<dependency>
	<groupId>org.hibernate.search</groupId>
	<artifactId>hibernate-search-mapper-orm</artifactId>
	<version>6.0.10.Final</version>
</dependency>
<dependency>
	<groupId>org.hibernate.search</groupId>
	<artifactId>hibernate-search-backend-lucene</artifactId>
	<version>6.0.10.Final</version>
</dependency>

After i moved the Indexed and IndexedEmbedded to differente package: org.hibernate.search.mapper.pojo.mapping.definition.annotation.*
and i changed all annotations like @Field @Sortablefield to @GenericField(sortable = Sortable.YES)

Compile my project and i got this problem.

type ‘.ObjectA’:
path ‘.propertyName.id’:
index ‘idx_name’:
failures:
- HSEARCH600080: Invalid index field type: missing decimal scale. Define the decimal scale explicitly.

The code of entities is:

@Indexed(index = "idx_name")
@Table(name = "tableName")
public class ObjectΑ {
	
	@Id
	@Column(name = "id", nullable = false, precision = 18)
	private BigInteger id;
	
	
	@ManyToOne(fetch = FetchType.LAZY, optional = false)
	@JoinColumn(name = "propertyNameId", nullable = false)
	@IndexedEmbedded
	private ObjectB propertyName;
}

@Indexed(index = "idx_name2")
@Table(name = "tableName2")
public class ObjectΒ {
	
	@Id
	@Column(name = "id", nullable = false, precision = 18)
    @GenericField(name = "pkid")
	private BigInteger id;
}

Thank you !

Hello,

For the migration, see the migration guide, which should address a lot of the problems you’ll encounter.

This particular problem is not addressed, though, and you seem to be the first one to encounter it :slight_smile: . The error message is indeed confusing, we’ll address that soon: [HSEARCH-4781] - Hibernate JIRA . And to be honest, you shouldn’t even have had this error with this configuration, so we’ll try to improve on that, too: [HSEARCH-4782] - Hibernate JIRA Thanks for reporting!

As to the solution: you will need to use @ScaledNumberField to set the decimal scale explicitly:

@Indexed(index = "idx_name2")
@Table(name = "tableName2")
public class ObjectΒ {
	
	@Id
	@Column(name = "id", nullable = false, precision = 18)
	@ScaledNumberField(name = "pkid", decimalScale = 0)
	private BigInteger id;
}

Thank you for your answer. It solved my problem. Now i have to resolve the following errors ! :smiley:

A post was split to a new topic: @GenericField and full-text search