3

I have:

criteria.createAlias(withAlias(alias, PLAN_PROPERTY), PLAN_ALIAS)
                    .add(Restrictions.eqProperty(withAlias(alias, "course"), withAlias(PLAN_ALIAS, "years")));

where course is integer, years is float. Need to do FLOOR() on the years property. alias is the current entity alias.

I would like to do this with Restrictions.sqlRestriction() like this:

Restrictions.sqlRestriction("{alias1}.course = FLOOR({alias2}.years)")

but we can use only the keyword {alias} that is processed by hibernate and returns the current criteria root entity alias. How to do this with two different aliases of inner join tables?

Alexey Semenyuk
  • 3,263
  • 2
  • 32
  • 36

0 Answers0