67,549
社区成员




hibernate的cfg文件如下:
<session-factory>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="hibernate.connection.url">
jdbc:sqlserver://172.16.4.252:1433;databasename=CemsCenter
<!--jdbc:MySQL://172.16.4.187:3306/overtime-->
</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">123</property>
<!-- <property name="connection.driver_class">
org.gjt.mm.mysql.Driver
</property>-->
<property name="hibernate.connection.driver_class">
com.microsoft.sqlserver.jdbc.SQLServerDriver
<!--com.mysql.jdbc.Driver-->
</property>
<!-- C3P0连接池设定-->
<!-- <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider
</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.timeout">120</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">120</property>
<property name="hibernate.c3p0.acquire_increment">2</property> -->
<property name="myeclipse.connection.profile">
sqlServer
</property>
<property name="show_sql">true</property>
<mapping resource="testDao/BasUserInfo.hbm.xml" />
</session-factory>
hibernate的hbm文件如下:
<hibernate-mapping>
<class name="testDao.BasUserInfo" table="Bas_UserInfo" schema="dbo" >
<id name="id" type="java.lang.String">
<column name="ID" length="36" />
<generator class="native" />
</id>
<property name="account" type="java.lang.String">
<column name="Account" />
</property>
<property name="userName" type="java.lang.String">
<column name="UserName" />
</property>
<property name="pwd" type="java.lang.String">
<column name="PWD" />
</property>
<property name="roleId" type="java.lang.String">
<column name="RoleID" />
</property>
<property name="email" type="java.lang.String">
<column name="EMail" />
</property>
<property name="del" type="java.lang.Short">
<column name="Del" />
</property>
</class>
</hibernate-mapping>
java类如下:
public class BasUserInfo implements java.io.Serializable
{
// Fields
private String id;
private String account;
private String userName;
private String pwd;
private String roleId;
private String email;
private Short del;
// Constructors
/** default constructor */
public BasUserInfo()
{
}
/** minimal constructor */
public BasUserInfo(String id, String account, String pwd)
{
this.id = id;
this.account = account;
this.pwd = pwd;
}
/** full constructor */
public BasUserInfo(String id, String account, String userName, String pwd, String roleId, String email, Short del)
{
this.id = id;
this.account = account;
this.userName = userName;
this.pwd = pwd;
this.roleId = roleId;
this.email = email;
this.del = del;
}
// Property accessors
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public String getAccount()
{
return this.account;
}
public void setAccount(String account)
{
this.account = account;
}
public String getUserName()
{
return this.userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getPwd()
{
return this.pwd;
}
public void setPwd(String pwd)
{
this.pwd = pwd;
}
public String getRoleId()
{
return this.roleId;
}
public void setRoleId(String roleId)
{
this.roleId = roleId;
}
public String getEmail()
{
return this.email;
}
public void setEmail(String email)
{
this.email = email;
}
public Short getDel()
{
return this.del;
}
public void setDel(Short del)
{
this.del = del;
}
}