Exception in com.lailife.service.NeedsService.getUserNeeds() with cause = 'org.hibernate.TransactionException: Unable to rollback against JDBC Connection' and exception = 'Could not roll back JPA transaction; nested exception is org.hibernate.TransactionException: Unable to rollback against JDBC Connection'
org.springframework.transaction.TransactionSystemException: Could not roll back JPA transaction; nested exception is org.hibernate.TransactionException: Unable to rollback against JDBC Connection
有的时候可以正常查询插入成功。
有的时候Transactional不能回滚然后报错了。
解决:查询不需要@Transactional注解,删掉所有查询的@Transactional注解。改好了~