Ich möchte Entitäten im Elasticsearch-Index mit MassIndexer
System aus Hibernate-Search-Orm-Projekt neu indizieren.Hibernate-Suche MassIndexer ERROR
Es könnte toll sein;) aber es gibt mir einige Ausnahmen.
jedoch, wie Sie unten sehen können, beispielsweise ist einfach:
das Unternehmen:
@Entity @Table(name = "STUDENT") @Indexed @ProvidedId (bridge = @FieldBridge(impl = StudentFieldBridge.class)) public class StudentEntity { @EmbeddedId private RegistrationId regid; @Field private String name; ... }
die
registrationId
:@Embeddable public class RegistrationId implements Serializable{ @Column(name = "STUDENT_ID") private int studentId; @Column(name = "DEPARTMENT") private String department; ... }
der Student Feldbrücke:
public class StudentFieldBridge implements TwoWayStringBridge { @Override public Object stringToObject(String stringValue) { String[] split = stringValue.split("_"); RegistrationId ret = new RegistrationId(); ret.setDepartment(split[0]); ret.setStudentId(Integer.parseInt(split[1])); return ret; } @Override public String objectToString(Object object) { RegistrationId id = (RegistrationId) object; return id.getDepartment() + "_" + id.getStudentId(); } }
die Masse Indexierungs
@Test public void massIndexation() throws InterruptedException { EntityManager em = Persistence.createEntityManagerFactory("studentPu").createEntityManager(); org.hibernate.Session hibernateSession = (Session)em.getDelegate(); FullTextSession fullTextSession = Search.getFullTextSession(hibernateSession); fullTextSession.createIndexer().startAndWait(); }
und schließlich der Fehler:
ERROR: HSEARCH000058: HSEARCH000212: An exception occurred while the MassIndexer was transforming identifiers to Lucene Documents java.lang.NullPointerException at org.hibernate.loader.criteria.CriteriaQueryTranslator.getEntityName(CriteriaQueryTranslator.java:626) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:509) at org.hibernate.loader.criteria.CriteriaQueryTranslator.findColumns(CriteriaQueryTranslator.java:525) at org.hibernate.criterion.InExpression.toSqlString(InExpression.java:43) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:400) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:106) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:75) at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:80) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1760) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363) at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.loadList(IdentifierConsumerDocumentProducer.java:175) at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.loadAllFromQueue(IdentifierConsumerDocumentProducer.java:140) at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.run(IdentifierConsumerDocumentProducer.java:117) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:744)
Java-Projekt Abhängigkeiten sind:
testCompile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '5.0.8.Final'
testCompile group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.6.0.Alpha3'
testCompile group: 'org.hibernate', name: 'hibernate-search-backend-elasticsearch', version: '5.6.0.Alpha3'
Dank Projekt Team für Ihren Job!
Verwandte Problem: https://hibernate.atlassian.net/browse/ HSEARCH-1645 – Sanne