Yes, you can, but it seems that it must be an expression such as a calculation, here is the full details of what I am trying to do with the
Junit test case include, that might help...
Here is the Hibernate query :
return sessionFactory.getCurrentSession().createQuery("select ( (year(pet.birthDate) - year(pet.birthDate)) + "+ "(month(pet.birthDate) - month(pet.birthDate)) + "+"(day(pet.birthDate) - day(pet.birthDate)) + "+
"(hour(pet.birthDate) - hour(pet.birthDate)) ) > 24 as dateValue, pet.birthDate as realDate from Pet pet").setResultTransformer( Transformers.aliasToBean(DateDTO.class) ).list();
Here is the Java StackTrace (I am sparing you the junit Java scrap that does'nt mean anything and only pin-point the hibernate error) :
2009-02-07 07:12:16,714 ERROR [org.hibernate.hql.PARSER] - <AST>:1:195: unexpected AST node: >
2009-02-07 07:12:16,714 WARN [org.springframework.test.context.TestContextManager] - Caught exception while allowing TestExecutionListener
In short, the operator > seems to cause issue, but that`s a boolean in the expression I want to rerieve, if I do only the calculation as an expression it pass, may somebofy helps...
|