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 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑