在拼写hql 的时候 使用方法 cast (字段名 as 要转化成的类型):
例如 from PayProduct as p ORDER BY CAST(p.propId as integer) ASC" 这里的字段 propid 原来是 String (DB内类型varchar ) 现在要转化为 Int 类型 。
本文详细介绍了在拼写HQL时如何使用CAST方法将字段从字符串类型转换为整数类型,以实现特定的排序操作。通过实例演示了在SQL查询中应用该方法的过程。
在拼写hql 的时候 使用方法 cast (字段名 as 要转化成的类型):
例如 from PayProduct as p ORDER BY CAST(p.propId as integer) ASC" 这里的字段 propid 原来是 String (DB内类型varchar ) 现在要转化为 Int 类型 。

被折叠的 条评论
为什么被折叠?
