I was wondering what the factory class was to convert an object's class (like Date or String) to the equivalent Hibernate type (StringType or DateType for instance) was. The reason I'm asking is because session.iterate() takes in a Type[] array and that's not very convenient to handle generically. Here is the code I'm working with that returns the first value.
Code:
protected Object findOneValue( final String queryString, final Object[] objects ) {
HibernateCallback callback = new HibernateCallback() {
public Object doInHibernate( Session session ) throws HibernateException, SQLException {
Type[] types = new Type[ objects.length ];
for( int i = 0; i < types.length; i++ ) {
types[ i ] = ??
}
return session.iterate( queryString, objects, types ).next();
}
};
return getHibernateTemplate().execute( callback );
}