关键在于CjhbPK主键类要实现Serializable接口
<?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">
<hibernate-mapping>
<class
name="com.hengtian.bondtradingsys.entity.business.exchange.realtime.Cjhb"
table="ashare_cjhb">
<composite-id name="pk" class="com.hengtian.bondtradingsys.entity.business.exchange.realtime.CjhbPK">
<key-property name="cjbh" column="cjbh" type="java.lang.Integer"/>
<key-property name="bs" column="bs" type="java.lang.String"/>
</composite-id>
<property name="gddm" column="gddm" type="java.lang.String" />
<property name="gdxm" column="gdxm" type="java.lang.String" />
<property name="bcrq" column="bcrq" type="java.lang.String" />
<property name="gsdm" column="gsdm" type="java.lang.String" />
<property name="cjsl" column="cjsl" type="java.lang.String" />
<property name="bcye" column="bcye" type="java.lang.String" />
<property name="zqdm" column="zqdm" type="java.lang.String" />
<property name="sbsj" column="sbsj" type="java.lang.String" />
<property name="cjsj" column="cjsj" type="java.lang.String" />
<property name="cjjg" column="cjjg" type="java.lang.String" />
<property name="cjje" column="cjje" type="java.lang.String" />
<property name="sqbh" column="sqbh" type="java.lang.String" />
<property name="mjbh" column="mjbh" type="java.lang.String" />
</class>
</hibernate-mapping>
import java.io.Serializable;
public class CjhbPK implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private Integer cjbh;
private String bs;
public Integer getCjbh() {
return cjbh;
}
public void setCjbh(Integer cjbh) {
this.cjbh = cjbh;
}
public String getBs() {
return bs;
}
public void setBs(String bs) {
this.bs = bs;
}
}