乐观锁。高并发

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

 

乐观锁时hibernate有的一个锁的机制

<hibernate-mapping package="com.xiaohao.test">

 

    <class name="User"  table="user" optimistic-lock="version" >

              <id name="id">

            <generator class="native" />

        </id>

        <!--version标签必须跟在id标签后面-->

        <version column="version" name="version"  />

        <property name="userName"/>

        <property name="password"/>

                 

    </class>

     

 

</hibernate-mapping>

posted @ 2019-12-30 17:18  周千  阅读(228)  评论(0编辑  收藏  举报