Hi wiedmann,
Yes I think you are right; Emmanuel's post in the other thread confirms your thoughts and there is more code in Search (look at iterators) that shows some effort to "skip" unexistent results. (e.g. IteratorImpl hasNext() ).
But there still is a problem: the code in ObjectLoader
is catching ObjectNotFoundException exceptions at line 27,
so if you are having this problem thrown at line 27 (and not 25) then the problem is actually about the Eception type not being recognized;
there's and "if" there that swallows all ObjectNotFoundException both from JPA or Hibernate core, but throws all other type of exceptions.
Code:
25 Object maybeProxy = session.get( entityInfo.clazz, entityInfo.id );
26 try {
27 Hibernate.initialize( maybeProxy );
}
catch (RuntimeException e) {
if ( LoaderHelper.isObjectNotFoundException( e ) ) {
log.debug( "Object found in Search index but not in database: "
+ entityInfo.clazz + " wih id " + entityInfo.id );
maybeProxy = null;
}
else {
throw e;
}
}
So maybe you have a classloader problem; are you sure you don't have different copies of the same jar / classes, from different versions or multiple copies of the same one?
Could you please verify this?