2016-07-15 13 views
2

Bitte meine beiden TabellenHibernate - Fremdschlüssel Abfrage Fehler

CREATE TABLE "DBS_P2P"."KW_PAYMENT_IMAGEE_TEST"(IMAGE_KEY INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 INCREMENT BY +1 MINVALUE +1 MAXVALUE +2147483647 NO CYCLE CACHE 20 NO ORDER),REQUEST_ID INTEGER,IMAGE_CONTENT CLOB(5120000),FOREIGN KEY(REQUEST_ID) REFERENCES KW_PAYMENT_LINK_MASTER_TEST(REQUEST_ID)) 



CREATE TABLE "DBS_P2P"."KW_PAYMENT_IMAGEE_TEST"(IMAGE_KEY INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 INCREMENT BY +1 MINVALUE +1 MAXVALUE +2147483647 NO CYCLE CACHE 20 NO ORDER),REQUEST_ID INTEGER,IMAGE_CONTENT CLOB(5120000),FOREIGN KEY(REQUEST_ID) REFERENCES KW_PAYMENT_LINK_MASTER_TEST(REQUEST_ID)) 


<hibernate-mapping> 
<class name="xyz" table="KW_PAYMENT_LINK_MASTER_TEST" catalog="xyz"> 
    <id name="requestId" type="int"> 
     <column name="REQUEST_ID"/> 
     <generator class="identity" /> 
    </id> 

    <property name="referenceWalletId" type="string"> 
     <column name="REFERENCE_ID"/> 
    </property> 

</class> 

<hibernate-mapping> 
<class name="com.kony.p2p.bo.KwPaymentImagetest" table="KW_PAYMENT_IMAGEE_TEST" catalog="DBS_P2P"> 

    <id name="imageKey" type="int"> 
     <column name="IMAGE_KEY" /> 
     <generator class="identity" /> 
    </id> 

    <many-to-one name="KwPaymentLinkMastertest" class="com.kony.p2p.bo.KwPaymentLinkMastertest" fetch="select" lazy="false"> 
     <column name="REQUEST_ID" not-null="false" /> 
    </many-to-one> 

    <property name="imageContent" type="string"> 
     <column name="IMAGE_CONTENT" not-null="false" /> 
    </property> 

</class> 
<filter-def name="myFilter"> 

Im fähig einfügen, aber nicht in der Lage finden Sie das Ergebnis abzurufen.

session.createCriteria(KwPaymentLinkMastertest.class).add(Restrictions.eq("requestId", Integer.parseInt(transactionReferenceNumber))).uniqueResult(); 


    KwPaymentImagetest image = (KwPaymentImagetest) session.createCriteria(KwPaymentImagetest.class).add(Restrictions.eq("kwPaymentLinkMastertest", kwPaymentLinkMastertest)).uniqueResult(); 

gibt es die folgenden Fehler

org.hibernate.QueryException: konnte nicht Eigentum beheben: kwPaymentLinkMastertest von: com.kony.p2p.bo.KwPaymentImagetest

Bitte helfen

Antwort

2

mir fix Ich denke du hast hier einen Tippfehler.

<many-to-one name="KwPaymentLinkMastertest" with K is upper case 
while Restrictions.eq("kwPaymentLinkMastertest" with k is lower case. 
0

Ya, Sie haben Recht.

Das Problem war mit Klein- und Großbuchstaben, dies half mein Problem zu beheben.

Danke.