我想执行以下 sql 查询
SELECT * FROM users u JOIN `friendship` f ON u.id = f.f_uid WHERE f.u_uid = 118 AND u.lastDataFetched >= DATE_SUB(CURDATE(),INTERVAL 7 DAY)) order by f.mutual_friendship_count
如何使用 hibernate 3.0 编写 hql 查询
我是这样写的
String[] parameterName={"usersByUUid","inthepastday"};
Object[] paramValues = {user,"7"};
List<Friendship> friendshipFriend = getHibernateTemplate().findByNamedParam(" from Users u JOIN Friendship f on u.id = f.f_uid where f.u_uid = :usersByUUid and date_sub(now(),interval :inthepastday day) >=u.lastDataFetched order by f.mutual_friendship_count ", parameterName,paramValues);
但它显示 hql 语法错误