日期:2014-05-18 浏览次数:20668 次
public class Employee {
private Integer e_id;
private String e_name;
private String e_email;
getters();....
setters();....
}
<hibernate-mapping package="com.zmj.domain">
<class name="Employee" table="employee">
<id name="e_id" column="e_id" type="java.lang.Integer">
<generator class="native"></generator>
</id>
<property name="e_name" column="e_name" type="java.lang.String"/>
<property name="e_email" column="e_email" type="java.lang.String"/>
</class>
</hibernate-mapping>
create table employee(
e_id integer primary key,
e_name varchar(64),
e_email varchar(64),
)
Employee e = new Employee();
e.setE_email("aa@163.com");
e.setE_name("aa");
e.setE_id(1);
session.save(e);
transaction.commit();
session.close();