xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.hibernate.model">
<class name="Hibernate" table="hibernate_001">
<id name="id"></id>
<property name="age"></property>
<property name="name"></property>
</class>
</hibernate-mapping>
这样设置
在实体类里面要
@Entity
public class Hibernate {
@Id
public int getAge() {
return age;
}
l联合主键
@id @idclass
idclass连接的是一个bean