Hey there,
I am using the following dependencies:
'org.hibernate:hibernate-search-orm:5.11.5.Final'
'org.apache.lucene:lucene-sandbox:5.5.5'
'org.springframework:spring-context-indexer:5.2.8.RELEASE'
I have the following superclass for my entities, so I do not have to add an id field for each class manually:
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import java.util.UUID;
@Getter
@MappedSuperclass
@NoArgsConstructor
@AllArgsConstructor
public abstract class TableModelAutoId extends TableModel {
@Id
@Type(type = "uuid-char")
@GeneratedValue(generator = "UUID")
@Column(name = "id", updatable = false, nullable = false, unique = true)
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID id;
}
I am using @Indexed on a few of my entities. My question is the following:
Can I prevent hibernate search / lucene from indexing the id field? Normally that is a good idea, but in this case, it does not make much sense, because it is an UUID…
I hope, that you can help me, did not found any solution so far…
TNT2k