首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

时间戳兑现乐观锁

2012-08-28 
时间戳实现乐观锁Person.javapackage cn.lxl.pojopublic class Person {private Integer idprivate Stri

时间戳实现乐观锁

Person.java
package cn.lxl.pojo;public class Person {private Integer id;private String username;private String password;//设置一个属性,时间戳实现乐观锁//不提供 setter和 getter方法private java.sql.Timestamp updateTime;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}}

?

Person.hbm.xml
<?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-mapping><class name="cn.lxl.pojo.Person" table="t_Person"><id name="id"><generator column="update_time" access="field" ></timestamp><property name="username"><column name="username"></column></property><property name="password"><column name="password"></column></property></class></hibernate-mapping>

?

热点排行