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();

Activity

Show:

Sanne GrinoveroApril 6, 2010 at 8:44 PM

Hi Marco, thanks for reporting this. I think it should be solved now but please check as in all my tests this projection is returning a Long.
You can checkout the sources or wait a few weeks for CR1 to be released.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created April 6, 2010 at 5:37 PM
Updated July 1, 2010 at 12:38 PM
Resolved April 6, 2010 at 8:32 PM