将mysql查询转换为HQL

时间:2016-03-02 09:07:52

标签: sql hibernate hql

 select distinct gv.geoname,gv.GeoHierLevelCode,
 SUBSTRING_INDEX(SUBSTRING_INDEX(gd.geohierpath,'/',4),'/',-1)
 from HavellsUserSalesForceMapping hs,geohiervalue gv,geohierpathdetails gd
 where hs.userCode = '00000001'
 and hs.cmpCode = gv.cmpCode
 and gv.geoCode IN (hs.geoCode)
 and gd.geohierpath LIKE CONCAT('%/',gv.geoCode,'/%') ;

SUBSTRING_INDEX对我来说是个问题。告诉我转换为hql的实际方法

1 个答案:

答案 0 :(得分:0)

使用@Formula annotation并为表达式定义虚拟字段。然后该字段可用于HQL查询。

相关问题