This is what I did !
I create a method called 'createNewInstance' which return an Object, used in criteria restriction:
Code:
criteria.add(Restrictions.ilike("sample.entry_date", createNewInstance("Sample", "entry_date", "30/04/2006")));
createNewInstance method takes 3 String parameters : the first and the second are the class name and the field name; I retrieve the corresponding data type and I build and return a new instance of this data type object with the third String parameter.
In that way, I have the good instancied object to put in the restriction methods ! With the example I gave below, createNewInstance returns a new java.util.Date with 30/04/2006.
Since yesterday, I had problems with all Restrictions methods like ilike, gt, lt...
Today, I carefully did my test and actually, only the ilike method doesn't work !!! the same code, but not the method name !!! ilike method doesn't work and gt does ???
Code:
criteria.add(Restrictions.ilike("sample.entry_date", createNewInstance("Sample", "entry_date", "30/04/2006")));
criteria.add(Restrictions.gt("sample.entry_date", createNewInstance("Sample", "entry_date", "30/04/2006")));
Any idea ?