如何使用hql查询从jsonb获取数据

时间:2017-11-08 10:55:18

标签: json postgresql hibernate hql jsonb

我的数据库中有一个名为“info”的列,其类型为jsonb,如下所示:

info={'duration','metrics'}

我想使用hql查询来获取'duration'的数据

这是我正在尝试的查询:

    @Query(value = "select new com.hyginex.service.statistic.dto.NewWristbandRecordByUser(wrp.user.id, wrp.recordTimestamp, wrp.id, wrp.device.id, wrp.rssi, wrp.beacon.id, wrp.beacon.locatableType) " +
        "from WristbandRecordProcessed wrp where wrp.user.id = :userId and wrp.rssi is null and wrp.recordTimestamp > :lastTimestamp and wrp.recordType = 'HANDWASH' and (wrp.info->'duration')*(wrp.avgCrossing)>100 order by wrp.recordTimestamp ")

但是当我这样做时我会收到错误:

 (wrp.info->'duration')

即使没有''也尝试过,但仍然没有工作。

0 个答案:

没有答案
相关问题