weixin_42423440 2011-03-14 09:17
浏览 346
已采纳

hibernate 外键 插入数据问题

<hibernate-mapping>
    <class name="com.pojo.HrBranchInfo" table="hr_branch_info" schema="public">
        <id name="hbiNId" type="java.lang.Integer">
            <column name="hbi_n_id" />
            <generator class="sequence" />
        </id>
        <many-to-one name="hrEmpBase" class="com.pojo.HrEmpBase" fetch="select">
            <column name="hbi_n_operator" />
        </many-to-one>
        <many-to-one name="hrBranchInfo" class="com.pojo.HrBranchInfo" fetch="select">
            <column name="hbi_n_prior" not-null="false" />
        </many-to-one>
        <property name="hbiVName" type="java.lang.String">
            <column name="hbi_v_name" length="40" not-null="true" />
        </property>
        <property name="hbiCState" type="java.lang.String">
            <column name="hbi_c_state" length="1" not-null="true" />
        </property>
        <property name="hbiVDesc" type="java.lang.String">
            <column name="hbi_v_desc" length="200" />
        </property>
        <property name="hbiCTime" type="java.lang.String">
            <column name="hbi_c_time" length="14" />
        </property>
        <property name="hbiNSortindex" type="java.lang.String">
            <column name="hbi_n_sortindex" length="10" />
        </property>
        <property name="hbiVTemp1" type="java.lang.String">
            <column name="hbi_v_temp1" length="100" />
        </property>
        <property name="hbiVTemp2" type="java.lang.String">
            <column name="hbi_v_temp2" length="100" />
        </property>
        <property name="hbiVTemp3" type="java.lang.String">
            <column name="hbi_v_temp3" length="100" />
        </property>
        <set name="hrEmpBases" inverse="true">
            <key>
                <column name="hbi_n_id" not-null="true" />
            </key>
            <one-to-many class="com.pojo.HrEmpBase" />
        </set>
        <set name="hrRelationBranduties" inverse="true">
            <key>
                <column name="hbi_n_id" not-null="true" />
            </key>
            <one-to-many class="com.pojo.HrRelationBranduty" />
        </set>
        <set name="hrBranchInfos" inverse="true">
            <key>
                <column name="hbi_n_prior" not-null="true" />
            </key>
            <one-to-many class="com.pojo.HrBranchInfo" />
        </set>
    </class>
</hibernate-mapping>

 这是一个数据表的配置文件,在我插入数据的时候提示我“錯誤: 欄位"hbinprior"不存在”,请大家帮忙看看。

 

 

 

  • 写回答

1条回答

  • redstarofsleep 2011-03-14 09:35
    关注

    [code="xml"][/code]

    你把 fetch="select",这样只有查询的时候才关联吧,把这个属性去掉试试

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果