联合主键
XML配置方法
1.新建一个用于存放联合主键的类.
2.配置映射文件
package com.meiyoudao.domain;import javax.persistence.Entity;import javax.persistence.Id;import javax.persistence.IdClass;@Entity@IdClass(com.meiyoudao.domain.PersonPK.class)public class PersonAnno {private int id;private String name;private String weight;@Idpublic int getId() {return id;}public void setId(int id) {this.id = id;}@Idpublic String getName() {return name;}public void setName(String name) {this.name = name;}public String getWeight() {return weight;}public void setWeight(String weight) {this.weight = weight;}}