我有一个MySQL查询,我想将这个查询转换为Hibernate查询。这是我到目前为止尝试过的。将mysql查询转换为hibernate查询
userInQuery = "SELECT * FROM log where userName in(";
userCountQuery = "SELECT count(*) FROM log where userName in(";
for (int i = 0; i < users.length; i++) {
userInQuery += "'" + users[i] + "',";
userCountQuery += "'" + users[i] + "',";
}
userInQuery = userInQuery.substring(0, userInQuery.lastIndexOf(","))+ ") and
systemdate >= STR_TO_DATE('" + fromDt+ "' ,'%Y-%m-%d') and systemdate <=
STR_TO_DATE('"+ toDate + "','%Y-%m-%d')";
userCountQuery = userCountQuery.substring(0, userCountQuery.lastIndexOf(","))+ ")
and systemdate >= STR_TO_DATE('"+ fromDt+ "' ,'%Y-%m-%d') and systemdate <=
STR_TO_DATE('"+ toDate + "','%Y-%m-%d')";
//System.out.println("Final userInQuery : " + userInQuery);
psmt = conn.prepareStatement(userInQuery);
rscount = stmt.executeQuery(userCountQuery);
给你的MySQL查询,以获取有关什么ü[R问清晰的概念。 – OO7
@ user000324我想问如何在查询和STR_TO_DATE在休眠 – user3441816