HQL两张表查询
select count(*) from Video v, Collectlist c where v.videoId=c.videoID and c.userID=2这条语句有问题吗?
Video表内videoID是主键,Collectlist里videoID,userID是外键,查询Collectlist表里用户ID为2的所有Video属性信息,
在Query query = getSession().createQuery(hql);处报错,报错的信息说could not resolve property: userID of: com.coe.entity.Collectlist
试了select count(*) from Video v, Collectlist c where v.videoId=c.getVideo().videoID and c.getUser().userID=2,也还是在Query query = getSession().createQuery(hql);报错,不过报错是10:21:30,356 ERROR PARSER:33 - <AST>:1:101: unexpected AST node: (
java.lang.NullPointerException
这两条语句有什么问题吗?