spring-data-jpa中findOne与getOne的区别

来源:互联网 发布:linux修改系统时间命令 编辑:程序博客网 时间:2024/06/05 00:48

findOne与getOne的注释

?
1
2
3
4
5
6
7
8
/**
     * Retrieves an entity by its id.
     
     * @param id must not be {@literal null}.
     * @return the entity with the given id or {@literal null} if none found
     * @throws IllegalArgumentException if {@code id} is {@literal null}
     */
    T findOne(ID id);
?
1
2
3
4
5
6
7
8
/**
     * Returns a reference to the entity with the given identifier.
     
     * @param id must not be {@literal null}.
     * @return a reference to the entity with the given identifier.
     * @see EntityManager#getReference(Class, Object)
     */
    T getOne(ID id);

getOne是“Returns a reference

0 0
原创粉丝点击