• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Mapping Problem in Hibernate

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am getting the below error in Hibernate...

Initial SessionFactory creation failed.org.hibernate.PropertyNotFoundException: field [treserveFactorPK.yearNo] not found on icp.entity.TreserveFactor

My mapping doc is as follows,

<class name="icp.entity.TannualStmtLine" table="TANNUAL_STMT_LINE">
<id column="ANNUAL_STMT_LN_ID" name="annualStmtLnId" type="string">
<generator class="assigned"/>
</id>
<property name="annualStmtLnNm" type="string">
<column length="30" name="ANNUAL_STMT_LN_NM" not-null="true"/>
</property>
<property name="updateTs" type="timestamp">
<column length="45" name="UPDATE_TS" not-null="true"/>
</property>
<property name="updUserId" type="string">
<column length="8" name="UPD_USER_ID" not-null="true"/>
</property>
<property name="exceptionIn" type="char">
<column length="1" name="EXCEPTION_IN" not-null="true"/>
</property>
<property name="ovAnnlStmtLnId" type="string">
<column length="3" name="OV_ANNL_STMT_LN_ID" not-null="true"/>
</property>
<set name="treserveFactors" table="TRESERVE_FACTOR">
<key column="ANNUAL_STMT_LN_ID"/>
<composite-element class="icp.entity.TreserveFactor">
<parent name="icp.entity.TannualStmtLine"/>
<many-to-one name="measureId" class="icp.entity.Tmeasure" column="MEASURE_ID"/>
<property name ="treserveFactorPK.yearNo" column="YEAR_NO"/>
<property name ="treserveFactorPK.yearNo" column="QUARTER_NO"/>
<many-to-one name="poolCd" class="icp.entity.TpoolCompanyPK" column="POOL_CD"/>
<many-to-one name="companyNo" class="icp.entity.TpoolCompanyPK" column="COMPANY_NO"/>
<property name ="crntResrvFctrPc" column="CRNT_RESRV_FCTR_PC"/>
<property name ="min1ResrvFctrPc" column="MIN1_RESRV_FCTR_PC"/>
<property name ="min2ResrvFctrPc" column="MIN2_RESRV_FCTR_PC"/>
<property name ="min3ResrvFctrPc" column="MIN3_RESRV_FCTR_PC"/>
<property name ="min4ResrvFctrPc" column="MIN4_RESRV_FCTR_PC"/>
<property name ="updateTs" column="UPDATE_TS"/>
<property name ="updUserId" column="UPD_USER_ID"/>
<property name ="min5ResrvFctrPc" column="MIN5_RESRV_FCTR_PC"/>
</composite-element>
</set>
</class>

The table TRESERVE_FACTOR structure is as follows,

CREATE TABLE REPORTER.TRESERVE_FACTOR
(
MEASURE_ID NUMBER NOT NULL,
YEAR_NO NUMBER NOT NULL,
QUARTER_NO NUMBER(1,0) NOT NULL,
POOL_CD CHAR(8) NOT NULL,
COMPANY_NO CHAR(4) NOT NULL,
ANNUAL_STMT_LN_ID CHAR(3) NOT NULL,
CRNT_RESRV_FCTR_PC NUMBER(13,6) DEFAULT 0 NOT NULL,
MIN1_RESRV_FCTR_PC NUMBER(13,6) DEFAULT 0 NOT NULL,
MIN2_RESRV_FCTR_PC NUMBER(13,6) DEFAULT 0 NOT NULL,
MIN3_RESRV_FCTR_PC NUMBER(13,6) DEFAULT 0 NOT NULL,
MIN4_RESRV_FCTR_PC NUMBER(13,6) DEFAULT 0 NOT NULL,
UPDATE_TS DATE NOT NULL,
UPD_USER_ID CHAR(8) NOT NULL,
MIN5_RESRV_FCTR_PC NUMBER(13,6) DEFAULT 0 NOT NULL
)

PRIMARY KEY (MEASURE_ID,YEAR_NO,QUARTER_NO,POOL_CD,COMPANY_NO,ANNUAL_STMT_LN_ID)


I have created the entity class for the table TRESERVE_FACTOR using Netbeans. It created two POJOS,
TreserveFactor -- POJO for Table it has TreserveFactorPK as one of the type
TreserveFactorPK --- POJO class for Primarykeys of TRESERVE_FACTOR table

[treserveFactorPK.yearNo] not found on icp.entity.TreserveFactor --- I have given the value as "yearNo" then also it says the same problem.

Please advise..


 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do we have two fields mapped to the same property below

Moreover as treserveFactorPK is a seperate class, it would have to be mapped as a composite property or better in a seperate hbm and put a mapping here.
 
hariharakarthi Subramanian
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your input. How to configure the property inside a composite-element as a composite-property.
Moreover, the TreserverFactorPK is a class generated for primary keys of the table TRESERVER_FACTOR, how to it is going to affect when I configure the TreserveFactorPK in a separate hbm file and if it is possible, then how to refer it in this above hbm file.

Thanks,
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic