@SuppressWarnings("unchecked")
public List getUsers() {
// 查询表中全部数据
List l = null;
String hql = "FROM Erpusers as eu ";
Query q = this.session.createQuery(hql);
l = q.list();
return l;
}
@SuppressWarnings("unchecked")
public List getByTwo(String pa, String ty) {
// 按指定的两个属性查询用户名
List l = null;
String h = " from Erpusers eu where (eu.password='"+pa+"' and
eu.userType='"+ty+"')";
l = this.session.createQuery(h).list();
return l;
}
}
4.配置文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.cici.erp.model.Erpusers" table="ERPUSERS" schema="SCOTT">
<id name="UId" type="java.lang.Long">
<column name="U_ID" precision="22" scale="0" />
<generator class="native" >
<param name="sequence">ERP_SEQ</param>
</generator>
</id>
<property name="username" type="java.lang.String">
<column name="USERNAME" length="40" not-null="true" />
</property>
<property name="password" type="java.lang.String">
<column name="PASSWORD" length="60" not-null="true" />
</property>
<property name="userType" type="java.lang.String">
<column name="USER_TYPE" length="10" />
</property>
<property name="userLock" type="java.lang.String">
<column name="USER_LOCK" length="1" />
</property>
</class>
</hibernate-mapping>
<< 上一页 [11] [12] [13] [14] [15] 下一页