在hql查询或条件中将字符串列强制转换为int

use*_*229 4 java hibernate hql

任何人都可以指导我哪里出错了吗?它给出零结果,但在db值中存在,条件出现在下面的查询中.

  Str = QueryImpl(from ArcZipCodeRange where cast(fromZip as int) >='12345' and cast(toZip as int)<='12345')
        arcZipCodeRangeList = 0
Run Code Online (Sandbox Code Playgroud)

Faz*_*zoM 6

你确定你的条件是否正确?

cast(fromZip as int) >='12345' and cast(toZip as int)<='12345')
Run Code Online (Sandbox Code Playgroud)

将给出所有结果from> 12345和to<12345.

应该是其他方式: from<12345和to> 12345?