我已经为我的班级 Intervento 配置了休眠搜索注释(4.1.1 版本库)。所以,我正在使用 jpa,在我的情况下,我可以省略@DocumentId
,但我有一个复合主键......
@IdClass(it.domain.InterventoPK.class)
@Entity
@Indexed
@AnalyzerDef(name = "interventongram", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class),
filters = {
@TokenFilterDef(factory = LowerCaseFilterFactory.class),
@TokenFilterDef(factory = StopFilterFactory.class, params = {
@Parameter(name = "words", value = "lucene/dictionary/stopwords.txt"),
@Parameter(name = "ignoreCase", value = "true"),
@Parameter(name = "enablePositionIncrements", value = "true")
}),
@TokenFilterDef(factory = ItalianLightStemFilterFactory.class),
@TokenFilterDef(factory = SynonymFilterFactory.class, params = {
@Parameter(name = "synonyms", value = "lucene/dictionary/synonyms.txt"),
@Parameter(name = "expand", value = "true")
}),
@TokenFilterDef(factory = SnowballPorterFilterFactory.class, params = {
@Parameter(name = "language", value = "Italian")
})
})
@Table(name = "intervento", catalog = "gestionale")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "Clinigo/it/domain", name = "Intervento")
@XmlRootElement(namespace = "Clinigo/it/domain")
public class Intervento implements Serializable {
private static final long serialVersionUID = 1L;
/**
*/
@Column(name = "idintervento", nullable = false)
@Basic(fetch = FetchType.EAGER)
@Id
@XmlElement
Integer idintervento;
/**
*/
@Column(name = "lingua_idlingua", nullable = false)
@Basic(fetch = FetchType.EAGER)
@Id
@XmlElement
Integer linguaIdlingua;
/**
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "version", nullable = false)
@Basic(fetch = FetchType.EAGER)
@XmlElement
Calendar version;
...
我越来越……你能帮帮我吗?
错误:HSEARCH000058:HSEARCH000116:MassIndexer 操作期间出现意外错误 java.lang.ClassCastException:it.domain.InterventoPK 无法在 org.hibernate.type.descriptor.java.IntegerTypeDescriptor.unwrap 中转换为 java.lang.Integer(IntegerTypeDescriptor.java: 36) 在 org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:92) 在 org.hibernate 的 org.hibernate.type.descriptor.sql.IntegerTypeDescriptor$1.doBind(IntegerTypeDescriptor.java:57)。 type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:305) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:300) at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1891) at org.hibernate .loader.Loader.bindParameterValues(Loader.java:1862) 在 org.hibernate.loader.Loader。prepareQueryStatement(Loader.java:1737) at org.hibernate.loader.Loader.doQuery(Loader.java:828) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) at org.hibernate.loader.Loader .doList(Loader.java:2447) 在 org.hibernate.loader.Loader.doList(Loader.java:2433) 在 org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263) 在 org.hibernate.loader。 Loader.list(Loader.java:2258) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:122) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1535) at org.hibernate .internal.CriteriaImpl.list(CriteriaImpl.java:374) 在 org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.loadList(IdentifierConsumerEntityProducer.java:150) 在 org.hibernate.search.batchindexing.impl。IdentifierConsumerEntityProducer.loadAllFromQueue(IdentifierConsumerEntityProducer.java:117) 在 org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.run(IdentifierConsumerEntityProducer.java:94) 在 org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java: 84) 在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 在 java.lang.Thread.run(Thread .java:619)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 在 java.lang .Thread.run(Thread.java:619)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 在 java.lang .Thread.run(Thread.java:619)