We're updating the issue view to help you get more done. 

IdentifierProducer: ClassCastException

Description

Executing the following code:

FullTextSession s = Search.getFullTextSession(session);
MassIndexer mi = s.createIndexer();
mi.optimizeOnFinish(true);
mi.batchSizeToLoadObjects(10);
mi.startAndWait();

I obtain the following exception:

Exception in thread "Hibernate Search: identifierloader-1" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at org.hibernate.search.batchindexing.IdentifierProducer.loadAllIdentifiers(IdentifierProducer.java:114)
at org.hibernate.search.batchindexing.IdentifierProducer.inTransactionWrapper(IdentifierProducer.java:103)
at org.hibernate.search.batchindexing.IdentifierProducer.run(IdentifierProducer.java:91)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The executed query is:
select
count(this_.idfornitore) as y0_
from
fornitore this_

The method loadAllIdentifiers() does the following cast:
Long totalCount = (Long) session
.createCriteria( indexedType )
.setProjection( Projections.count( "id" ) )
.setCacheable( false )
.uniqueResult();

Environment

hibernate-core-3.5.0-Beta-2.jar, hibernate-commons-annotations-3.2.0.Beta1.jar, hibernate-search-3.2.0.Beta1.jar, jtds-1.2.5.jar (SQL Server 2008), Java 6

Status

Assignee

Sanne Grinovero

Reporter

Marco Pirruccio

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Affects versions

3.2.0.Beta1

Priority

Blocker