尝试将视图映射到休眠实体时出错

时间:2013-03-25 11:34:52

标签: java hibernate

我创建了一个视图。

CREATE VIEW VW_LOSA_APP_PENDING AS
SELECT distinct app.APP_REF_NO, app.APP_STATUS, app.APP_DT, app.ATTEND_STAFF,
                app.ATTEND_BRANCH, app.PRODUCT_TYPE APP_PRODUCT_TYPE, 
                cust.CUST_ID, cust.APP_JOINT_T, cust.ID1_TYPE, cust.ID1, 
                cust.ID2_TYPE, cust.ID2, cust.FIRST_NAME, cust.LAST_NAME, 
                cust.FULL_NAME, cust.FULL_NAME_CAP, cust.DOB, fac.FACILITY_NO,
                fac.PRODUCT_TYPE FAC_PRODUCT_TYPE, fac.PRODUCT_CODE, 
                fac.MAIN_PROD_IND, fac.AMT_APPLIED
   FROM 
        LOSA_APP app 
   LEFT JOIN 
       LOSA_CUST cust 
   ON
       cust.APP_REF_NO = app.APP_REF_NO
   LEFT JOIN 
       LOSA_FACILITIES fac 
   ON
       fac.APP_REF_NO = app.APP_REF_NO
   LEFT JOIN 
       OS_CURRENTSTEP STEP 
   ON
       STEP.REF_ID = app.APP_REF_NO
   WHERE (app.APP_STATUS ='P' OR app.APP_STATUS ='T' OR 
         ((app.APP_STATUS='R' OR app.APP_STATUS='S') AND STEP.STEP_NAME='011'));

现在我正在尝试将此视图映射到hibernate文件。但我得到错误

enter image description here

这是我如何定义我的映射

<hibernate-mapping default-lazy="false">
<class name="com.thetasp.losa.data.VwLosaAppPending" table="VW_LOSA_APP_PENDING" optimistic-lock="version">     

    <property name="appRefNo" type="java.lang.String" column="APP_REF_NO" not-null="true" length="20" />
    <property name="appStatus" type="java.lang.String" column="APP_STATUS" length="20" />
    <property name="appDt" type="java.sql.Timestamp" column="APP_DT" not-null="true" length="23" />
    <property name="attendStaff" type="int" column="ATTEND_STAFF" not-null="true" length="10" />
    <property name="attendBranch" type="int" column="ATTEND_BRANCH" not-null="true" length="10" />
    <property name="appProductType" type="java.lang.String" column="APP_PRODUCT_TYPE" length="10" />
    <property name="custId" type="java.lang.String" column="CUST_ID" length="20" />
    <property name="appJointT" type="java.lang.String" column="APP_JOINT_T" length="10" />
    <property name="id1Type" type="java.lang.String" column="ID1_TYPE" length="1" />
    <property name="id1" type="java.lang.String" column="ID1" length="20" />
    <property name="id2Type" type="java.lang.String" column="ID2_TYPE" length="1" />
    <property name="id2" type="java.lang.String" column="ID2" length="20" />
    <property name="firstName" type="java.lang.String" column="FIRST_NAME" length="100" />
    <property name="lastName" type="java.lang.String" column="LAST_NAME" length="100" />
    <property name="fullName" type="java.lang.String" column="FULL_NAME" length="250" />
    <property name="fullNameCap" type="java.lang.String" column="FULL_NAME_CAP" length="250" />
    <property name="dob" type="java.sql.Date" column="DOB" length="23" />
    <property name="facilityNo" type="java.lang.Long" column="FACILITY_NO" />
    <property name="facProductType" type="java.lang.String" column="FAC_PRODUCT_TYPE" length="10" />
    <property name="productCode" type="java.lang.String" column="PRODUCT_CODE" length="20" />
    <property name="mainProdInd" type="java.lang.String" column="MAIN_PROD_IND" length="1" />
    <property name="amtApplied" column="AMT_APPLIED" length="18">
        <type name="com.thetasp.common.hibernate.support.ParameterizedDoubleType" />
    </property>

</class>

我在第

行收到错误
<class name="com.thetasp.losa.data.VwLosaAppPending" table="VW_LOSA_APP_PENDING" optimistic-lock="version">   

为什么我收到此错误?我做错了什么?

由于

1 个答案:

答案 0 :(得分:0)

消息是:

The content of element type "class" must match "([...], (id, composite-id), [...])

您的类定义中没有任何id或composite-id元素。