HQL 子查询查询选择
当我执行此查询时,我总是收到错误太多列。
SELECT o FROM Overlay o WHERE ( :coordinate ) IN ELEMENTS(o.blocksCoordinates)
如果我在 sql 中执行此操作,它会起作用:
Select * from Overlay overlay0_ where (0,0) in (select x, y from ...
坐标是一个带有 x 和 y 值的简单嵌入实体。
@ElementCollection
private Set<Coordinate> blocksCoordinates = new HashSet<Coordinate>();
我的坐标实体:
@Embeddable
public class Coordinate implements Serializable {
private static final long serialVersionUID = -5866341829302555966L;
protected int x;
protected int y;
我做错了什么?
I always get the error too many Columns when i execute this query.
SELECT o FROM Overlay o WHERE ( :coordinate ) IN ELEMENTS(o.blocksCoordinates)
If i do it in sql it works:
Select * from Overlay overlay0_ where (0,0) in (select x, y from ...
Coordinate is a simple embedded entity with an x and y value.
@ElementCollection
private Set<Coordinate> blocksCoordinates = new HashSet<Coordinate>();
My Coordinate entity:
@Embeddable
public class Coordinate implements Serializable {
private static final long serialVersionUID = -5866341829302555966L;
protected int x;
protected int y;
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试相反的方式:
或者使用
with
关键字:使用该查询应该返回 c = 坐标上的连接成功的任何 Overlay。
编辑:或者,尝试使用 x 和 y 值:
Try it the other way round:
Or using the
with
keyword:Using that query should return any Overlay for which the join on c = coordinate succeeded.
Edit: Alternatively, try to use the x and y values: