
Originally Posted by
meissa
I'm trying to reach the criteria api within the HibernateCallBack.
I' don't undestand while my code can't compile.
I'm getting "the method createCriteria(Session,Class) is undefined for the type <anonymous implementation oh HibernateCallback> compilation error message.
here is the method in cause :
public TStructureLibelle findByCrit(final String codeStructure,final Date now) throws FinderException
{
TStructureLibelle result=null;
result=(TStructureLibelle)getHibernateTemplate().e xecute(
new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException
{
Criteria criteria=createCriteria(session,TStructureLibelle. class);
criteria.add(Expression.eq("structure.codeStructur e",codeStructure));
criteria.add(Expression.le("dateDebutValidite",now ));
criteria.add(Expression.ge("dateFinValidite",now)) ;
return criteria.uniqueResult();
}
});
return result;
}
My class extends HibernateDaoSupport
Can someone please tells me what's wrong in my code.
thanks in advance
Meissa