如何在HQL中将映射的字符串值转换为整数

时间:2019-07-01 10:49:12

标签: hql

我想将映射(扩展)中的字符串值(键类别)转换为整数值,以将其与where子句中的参数进行比较。

我尝试了以下代码段,但无效:

WHERE cast(l.extended['category'] as int) >= :minCategory

有什么想法吗?

谢谢

更新:GRAILS实体代码

class Location implements Serializable{

    String name
    String searchName

    Address address = new Address()

    Geometry geometry //longitude x, latitude y 

    String id

    Date dateCreated
    Date lastUpdated

    //optionally dynamic properties
    Map extended

    static embedded = ['address']

    static constraints = {
        address nullable: true
        extended nullable: true        
    }

    static mapping = {
        id generator: "assigned"
    }
}

0 个答案:

没有答案