开发者

Hibernate findByID implementation

I found the 开发者_如何学JAVAfollowing code on net for fetching a object from DB.Now what does lock indicates?? Whe does it lock?

public T findById(ID id, boolean lock) {
        T entity;
        if (lock) {
            entity = (T) getSession().load(getPersistentClass(), id, LockMode.UPGRADE);
        } else {
            entity = (T) getSession().load(getPersistentClass(), id);
        }

        return entity;
    }


It just uses the appropriate Hibernate LockMode. If you have a more specific question, it might be easier to answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜