hibernate hql 时间比较 不能用setDate 用setTimestampe

String hql = "select  new  map(playerName ,SUM(ABS(winLossMoneyAfterTax))) from PlayLog where (gameTime between ? and ? ) and playerName in(:playerNames) group by  playerName";
List<Map> winlostMapList = this.getSession().createQuery(hql)
	.setTimestamp(0, startTime) //注意这里,用setTimestampe,不要用setDate   .setTimestamp(1, endTime)
	.setParameterList("playerNames", playerNames).list();

你可能感兴趣的:(hibernate hql 时间比较 不能用setDate 用setTimestampe)