<spring-boot.version>2.0.3.RELEASE</spring-boot.version>
<hibernate.version>5.2.17.Final</hibernate.version>
jpa 中查询对象中有很多操作 它们有什么区别那 我们从原码上分析
getOne :
当id为null 是会抛出异常信息findOne
public T getOne(ID id) {
Assert.notNull(id, "The given id must not be null!");
return this.em.getReference(this.getDomainClass(), id);
}
findOne 返回null
getById 默认会把查询出来的数据 事务管理起来 会在set属性是直接修改 对象后事物提交