在项目中遇到一个问题,在调用findByUserIdAndStartTime()这个jpa里面的方法,报错: javax.persistence.NonUniqueResultException: result returns more than one elements.
最后在数据库里面用了下面一条sql语句查询user_id>1的数据,看是否有数据错误:
SELECT user_id,start_time FROM ovuola_test.physiological_estimate_data where user_id in (select user_id from ovuola_test.physiological_estimate_data group by user_id having count(1) >= 2);