- 爱易网页
-
Java教程
- hibernate.hbm2ddl.auto设置成none仍然自动更改表结构解决方案
日期:2014-05-19 浏览次数:20835 次
hibernate.hbm2ddl.auto设置成none仍然自动更改表结构
hibernate配置文件如下:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="connection.url">jdbc:odbc:WebSite</property>
<property name="connection.username">sa</property>
<property name="connection.password">sa</property>
<property name="connection.driver_class">
sun.jdbc.odbc.JdbcOdbcDriver
</property>
<property name="hibernate.hbm2ddl.auto">none</property>
<mapping class="com.lujun.manage.login.entites.TblSysUser"/>
</session-factory>
</hibernate-configuration>
实体类如下:
package com.lujun.manage.login.entites;
import java.io.Serializable;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* The persistent class for the tbl_sys_user database table.
*
*/
@Entity
@Table(name="tbl_sys_user")
public class TblSysUser implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="user_id")
private String userId;
private int activated;
@Column(name="create_by")
private String createBy;
@Column(name="create_date")
private Timestamp createDate;
private String mobile;
@Lob()
private String note;
private String password;
private int sex;
private String tel;
@Column(name="user_login_name")
private String userLoginName;
@Column(name="user_name")
private String userName;
public TblSysUser() {
}
public String getUserId() {
return this.userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public int getActivated() {
return this.activated;
}
public void setActivated(int activated) {
this.activated = activated;
}
public String getCreateBy() {
return this.createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Timestamp getCreateDate() {
return this.createDate;
}
public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}
public String getMobile() {
return this.mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getNote() {
return this.note;
}
public void setNote(String note) {
this.note = note;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public int getSex() {
return this.sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getTel() {
return this.tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getUserLoginName() {
return this.userLoginName;
}