hibernate报错,求大神,在线等

wang4556299 2013-03-25 10:22:19
我把hibernate2升级成hibernate3,以前的时候是正常,
现在遇到映射文件有多表关联的地方就报错。下面是一个错误信息
org.hibernate.hql.ast.QuerySyntaxException:
tp3183.dat_tp3181.dat_tc3101 is not mapped [select count(distinct tp3183.gyosyano) from com.hitachijoho.cydeen.kjmng.model.Dat_TP3183 as tp3183, tp3183.dat_tp3181.dat_tc3101 as tc3101 where tp3183.supplyorgno ='0000' and tp3183.karitorokkbn='0' and tp3183.jyotai='02' and tp3183.nendo='2012' and tp3183.gyousyakbn = 'E' ]
请问各位大神这是为什么呢?
...全文
83 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wang4556299 2013-03-25
  • 打赏
  • 举报
回复
<?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.hitachijoho.cydeen.kjmng.model.Dat_TC3101"
        table="TC3101"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
    >

        <composite-id
            name="dat_gyosyapk"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_GyosyaPK"
        >
                     <key-property
                        name="nendo"
                        type="java.lang.String"
                        column="NENDO"
                />

                     <key-property
                        name="gyosyano"
                        type="java.lang.String"
                        column="GYOSYANO"
                />

        </composite-id>

        <property
            name="gyousyakbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="GYOUSYAKBN"
            not-null="false"
        />

        <property
            name="oldnendokbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="OLDNENDOKBN"
            not-null="false"
        />

        <property
            name="torokkbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="TOROKKBN"
            not-null="false"
        />
        <property
            name="zahyox"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="ZAHYOX"
            not-null="false"
        />

        <property
            name="zahyoy"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="ZAHYOY"
            not-null="false"
        />

        <property
            name="trkymd"
            type="java.sql.Timestamp"
            update="true"
            insert="true"
            access="property"
            column="TRKYMD"
            not-null="false"
        />

        <property
            name="updymd"
            type="java.sql.Timestamp"
            update="true"
            insert="true"
            access="property"
            column="UPDYMD"
            not-null="false"
        />

        <property
            name="upduserid"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="UPDUSERID"
            not-null="false"
        />

        <one-to-one
            name="dat_tc3111"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_TC3111"
            cascade="all"
            outer-join="auto"
            constrained="false"
        />

        <one-to-one
            name="dat_tc3121"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_TC3121"
            cascade="all"
            outer-join="auto"
            constrained="false"
        />

        <one-to-one
            name="dat_tc3131"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_TC3131"
            cascade="all"
            outer-join="auto"
            constrained="false"
        />

        <one-to-one
            name="dat_tc3141"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_TC3141"
            cascade="all"
            outer-join="auto"
            constrained="false"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Dat_TC3101.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>
wang4556299 2013-03-25
  • 打赏
  • 举报
回复
<?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.hitachijoho.cydeen.kjmng.model.Dat_TP3181"
        table="TP3181"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
    >

        <id
            name="sinsano"
            column="SINSANO"
            type="java.math.BigDecimal"
        >
            <generator class="assigned">
              <!--  
                  To add non XDoclet generator parameters, create a file named 
                  hibernate-generator-params-Dat_TP3181.xml 
                  containing the additional parameters and place it in your merge dir. 
              --> 
            </generator>
        </id>

        <property
            name="supplyorgno"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="SUPPLYORGNO"
            not-null="false"
        />

        <property
            name="nendo"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="NENDO"
            not-null="true"
        />

        <property
            name="gyosyano"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="GYOSYANO"
            not-null="true"
        />

        <property
            name="ninteikikansrt"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="NINTEIKIKANSRT"
            not-null="false"
        />

        <property
            name="ninteikikanend"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="NINTEIKIKANEND"
            not-null="false"
        />

        <property
            name="gyousyakbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="GYOUSYAKBN"
            not-null="false"
        />

        <property
            name="kamisinseikbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="KAMISINSEIKBN"
            not-null="false"
        />

        <property
            name="sinsekbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="SINSEKBN"
            not-null="false"
        />

        <property
            name="tiikikbn"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="TIIKIKBN"
            not-null="false"
        />

        <property
            name="riyosyatorok"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="RIYOSYATOROK"
            not-null="false"
        />

        <property
            name="sinsajyokyo"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="SINSAJYOKYO"
            not-null="false"
        />

        <property
            name="sinseiymd"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="SINSEIYMD"
            not-null="false"
        />

        <property
            name="kiboukojisyubetu"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="KIBOUKOJISYUBETU"
            not-null="false"
        />

        <property
            name="kiboukojikasyo"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="KIBOUKOJIKASYO"
            not-null="false"
        />

        <property
            name="tikucd"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="TIKUCD"
            not-null="false"
        />

        <property
            name="honsyatikucd"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="HONSYATIKUCD"
            not-null="false"
        />

        <property
            name="nozeijyokyo"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="NOZEIJYOKYO"
            not-null="false"
        />

        <property
            name="mainfinm"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="MAINFINM"
            not-null="false"
        />

        <property
            name="mainfibranchnm"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="MAINFIBRANCHNM"
            not-null="false"
        />

        <property
            name="yobi1"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="YOBI1"
            not-null="false"
        />

        <property
            name="yobi2"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="YOBI2"
            not-null="false"
        />
        <property
            name="trkymd"
            type="java.sql.Timestamp"
            update="true"
            insert="true"
            access="property"
            column="TRKYMD"
            not-null="false"
        />

        <property
            name="updymd"
            type="java.sql.Timestamp"
            update="true"
            insert="true"
            access="property"
            column="UPDYMD"
            not-null="false"
        />

        <property
            name="upduserid"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="UPDUSERID"
            not-null="false"
        />

        <set
            name="dat_tp3183s"
            table="TP3183"
            lazy="true"
            inverse="false"
            cascade="all"
            sort="unsorted"
            order-by="gyomucd"
        >

              <key
              >
                <column
                    name="sinsano" 
                />
              </key>

              <one-to-many
                  class="com.hitachijoho.cydeen.kjmng.model.Dat_TP3183"
              />

        </set>

        <many-to-one
            name="dat_tc3101"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_TC3101"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            access="property"
        >
            <column
                name="nendo" 
            />
            <column
                name="gyosyano" 
            />
        </many-to-one>

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Dat_TP3181.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>
wang4556299 2013-03-25
  • 打赏
  • 举报
回复
映射文件:
<?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.hitachijoho.cydeen.kjmng.model.Dat_TP3183"
        table="TP3183"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
    >

        <composite-id
            name="dat_shinsapk"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_ShinsaPK"
        >
                     <key-property
                        name="sinsano"
                        type="java.math.BigDecimal"
                        column="SINSANO"
                />

                     <key-property
                        name="gyomucd"
                        type="java.lang.String"
                        column="GYOMUCD"
                />

        </composite-id>

        <property
            name="supplyorgno"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="SUPPLYORGNO"
            not-null="false"
        />

        <property
            name="nendo"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="NENDO"
            not-null="true"
        />


        <property
            name="addition05ten"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="ADDITION05TEN"
            not-null="false"
        />

        <property
            name="addition06ten"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="ADDITION06TEN"
            not-null="false"
        />

        <property
            name="addition07ten"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="ADDITION07TEN"
            not-null="false"
        />

        <property
            name="addition08ten"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="ADDITION08TEN"
            not-null="false"
        />

        <property
            name="addition09ten"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="ADDITION09TEN"
            not-null="false"
        />

        <property
            name="trkymd"
            type="java.sql.Timestamp"
            update="true"
            insert="true"
            access="property"
            column="TRKYMD"
            not-null="false"
        />

        <property
            name="updymd"
            type="java.sql.Timestamp"
            update="true"
            insert="true"
            access="property"
            column="UPDYMD"
            not-null="false"
        />

        <property
            name="upduserid"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="UPDUSERID"
            not-null="false"
        />

        <set
            name="dat_tp318bs"
            table="TP318B"
            lazy="true"
            inverse="false"
            cascade="all"
            sort="unsorted"
            order-by="kojibunruicd"
        >

              <key
              >
                <column
                    name="sinsano" 
                />
                <column
                    name="gyomucd" 
                />
              </key>

              <one-to-many
                  class="com.hitachijoho.cydeen.kjmng.model.Dat_TP318B"
              />

        </set>

        <set
            name="dat_tp318as"
            table="TP318A"
            lazy="true"
            inverse="false"
            cascade="all"
            sort="unsorted"
            order-by="bumoncd"
        >

              <key
              >
                <column
                    name="sinsano" 
                />
                <column
                    name="gyomucd" 
                />
              </key>

              <one-to-many
                  class="com.hitachijoho.cydeen.kjmng.model.Dat_TP318A"
              />

        </set>

        <many-to-one
            name="dat_tp3181"
            class="com.hitachijoho.cydeen.kjmng.model.Dat_TP3181"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            access="property"
            column="sinsano"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Dat_TP3183.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧