Hi Community,
I have following problem:
For my application I have an EMF-Model (which cannot be changed). To create a Hibernate database I'm using Teneo. The creation of the Hibernate database is working quite well. Now I created the Search-Mapping for the classes to index via Programmatic API, looking like this (only the important part of the Factory):
Code:
SearchMapping searchMapping = new SearchMapping();
searchMapping.entity(Items.impl.PersonImpl.class).indexed()
.property("ident", ElementType.METHOD).documentId()
.property("firstname", ElementType.METHOD).field()
.property("lastname", ElementType.METHOD).field()
.property("birthday", ElementType.METHOD).field()
.property("address", ElementType.METHOD).containedIn()
.property("email", ElementType.METHOD).containedIn()
.entity(Items.impl.AddressImpl.class).indexed()
.property("ident", ElementType.METHOD).documentId()
.property("street", ElementType.METHOD).field()
.property("number", ElementType.METHOD).field()
.property("postalCode", ElementType.METHOD).field()
.property("city", ElementType.METHOD).field()
.entity(Items.impl.EMailImpl.class).indexed()
.property("ident", ElementType.METHOD).documentId()
.property("address", ElementType.METHOD).field()
.property("tag", ElementType.METHOD).field();
Important to know is, that the attribute "ident" of each entity is of type String.
When I start indexing the data from the database I get some errors like this:
Code:
ERROR: HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.hibernate.type.descriptor.java.StringTypeDescriptor.unwrap(StringTypeDescriptor.java:39)
at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:57)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:93)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:280)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:275)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1969)
at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1940)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1875)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1836)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1816)
at org.hibernate.loader.Loader.doQuery(Loader.java:900)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342)
at org.hibernate.loader.Loader.doList(Loader.java:2526)
at org.hibernate.loader.Loader.doList(Loader.java:2512)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2342)
at org.hibernate.loader.Loader.list(Loader.java:2337)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:124)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1662)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
at org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.loadList(IdentifierConsumerEntityProducer.java:152)
at org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.loadAllFromQueue(IdentifierConsumerEntityProducer.java:118)
at org.hibernate.search.batchindexing.impl.IdentifierConsumerEntityProducer.run(IdentifierConsumerEntityProducer.java:95)
at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I thought it should be due to the String-Type of the "ident" attribute and tried a TwoWayStringBridge without any success.
Google did not bring an answer to me, does anyone know how to solve this?
Kind regards,
Steven Künzel