那位高手给点线索呀,折腾了一下午了,下面是映射文件
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
 
<hibernate-mapping>
<class
    name="jp.co.dentsu.ecanon.common.data.ContentsTypeMaster" 
    table="CONTENTS_TYPE_MASTER"
    lazy="false"
>    <id
        name="contentsType"
        type="java.lang.Integer"
        column="CONTENTS_TYPE"
    >
    
        <generator class="assigned" />
    </id>    <property
        name="contentsName"
        type="java.lang.String"
        column="CONTENTS_NAME"
        length="20"
    />
    <property
        name="sortNo"
        type="java.lang.Integer"
        column="SORT_NO"
        length="1"
    /> <one-to-one 
name="campaignFile" 
class="CampaignFile" 
property-ref="contentsTypeMaster"
/>

</class>
</hibernate-mapping>

解决方案 »

  1.   

    hibernate.cfg.xml文件中 的 <mapping resource="xxx"/>
    检查这个文件中的xxx 的路径. 是否正确.
      

  2.   

    package jp.co.dentsu.ecanon.common.data;import java.io.Serializable;
    import org.apache.commons.lang.builder.EqualsBuilder;
    import org.apache.commons.lang.builder.HashCodeBuilder;
    import org.apache.commons.lang.builder.ToStringBuilder;public class ContentsTypeMaster implements Serializable {

        /** identifier field */
        private Integer contentsType;
        
        /** persistent field */
        private String contentsName;
        
        /** persistent field */
        private Integer sortNo;    /** full constructor */
        public ContentsTypeMaster(Integer contentsType, String contentsName, Integer sortNo) {
         this.contentsType = contentsType;
            this.contentsName = contentsName;
            this.sortNo = sortNo;
        }
        
        /** default constructor */
        public ContentsTypeMaster() {
        }
        
        public Integer getContentsType() {
    return contentsType;
    } public void setContentsType(Integer contentsType) {
    this.contentsType = contentsType;
    } public String getContentsName() {
    return contentsName;
    } public void setContentsName(String contentsName) {
    this.contentsName = contentsName;
    } public Integer getSortNo() {
    return sortNo;
    } public void setSortNo(Integer sortNo) {
    this.sortNo = sortNo;
    }    public String toString() {
            return new ToStringBuilder(this)
                .append("contentsType", getContentsType())
                .toString();
        }    public boolean equals(Object other) {
            if ( (this == other ) ) return true;
            if ( !(other instanceof ContentsTypeMaster) ) return false;
            ContentsTypeMaster castOther = (ContentsTypeMaster) other;
            return new EqualsBuilder()
                .append(this.getContentsType(), castOther.getContentsType())
                .isEquals();
        }    public int hashCode() {
            return new HashCodeBuilder()
                .append(getContentsType())
                .toHashCode();
        }    
    }
      

  3.   

    hibernate.cfg.xml应该不会有错,因为以前有许多映射文件,路径我都是拷贝过来的
      

  4.   

    妈的这种垃圾贴你也到处乱贴啊!Could not read mappings from resource!不明白是什么意思吗
    在你指定的路径找不到映射文件ContentsTypeMaster.hbm.xml!真服了你了,什么都不看,就乱发贴!