用hibernate 如何判断 某个记录别人正在修改啊,如何判断锁的状态和解锁啊!各位胸抬???

解决方案 »

  1.   

    我的答案仅供参考:
      我想是可不可以在Hibernate中添加线程机智呢,我想应该是可以的。
      如果有什么不妥当的地方请多多的指教
      

  2.   

    你可以调用session.lock方法啊,不过你A用户必须保持这个session不释放直到保存为止。
      

  3.   

    String hql = "select * from Parameter as e "
    +"where e.ID in (select d.parameterId from RightParameterRelation as d "  +"where d.ID in (select c.rightid from RoleRightRelation as c "
             +"where c.ID in (select b.roleid from GroupRoleRelation as b " 
    +"where b.ID in (select a.usergroupid from UserGroupRelation as a " 
    +"where a.userid='"+userid+"'))))";大家看这个语句有没有问题啊??
      

  4.   

    给取得sessionFactory方法前加synchronized关键字
      

  5.   

    synchronized怎么 加啊,胸台!!