I apologize in advance if the answer to this turns out to be in the docs, but in two days of looking I haven't found anything on this.
We have two tables, Surcharge and SurchargeDetail, where many surcharges can have the same surcharge detail.
When I run this snippet of code:
Code:
Criteria crit = session.createCriteria( SurchargeDetail.class );
crit.add( Expression.eq( "comp_id.surcharge.currentRow", "Y" ));
List list = crit.list();
I get the following error:
Quote:
TRAS0014I: The following exception was logged net.sf.hibernate.QueryException: could not resolve property: comp_id.surcharge.currentRow of: com.mydomain.db.bo.SurchargeDetail
This is odd since if I change the criteria expression field to
Code:
comp_id.surcharge.comp_id.surchargeId
it works. Anyone have a direction they could point me in to figure this out?
Relevant snippets of my mapping files are listed below, and were generated by Middlegen. I can post the .java files if need be, but they
are exactly what hbm2java generates from these mappings files.
Thanks,
Steve
Code:
<class
name="com.mydomain.db.bo.SurchargeDetail"
table="SURCHGDTL"
schema="PRICE"
>
<composite-id name="comp_id" class="com.mydomain.db.bo.SurchargeDetailPK">
<key-property
name="year"
column="YR"
type="java.lang.Integer"
length="10"
/>
<key-property
name="month"
column="MO"
type="java.lang.Integer"
length="10"
/>
<!-- bi-directional many-to-one association to Surcharge -->
<key-many-to-one
name="surcharge"
class="com.mydomain.db.bo.Surcharge"
>
<column name="CATCD" />
<column name="SURCHGID" />
<column name="EFFTS" />
</key-many-to-one>
</composite-id>
<timestamp
name="updateTimestamp"
column="UPDTS"
/>
<property
name="baseDollarAmount"
type="java.math.BigDecimal"
column="BASEDOL"
not-null="true"
length="12"
/>
And...
Code:
<class
name="com.mydomain.db.bo.Surcharge"
table="SURCHG"
schema="PRICE"
>
<composite-id name="comp_id" class="com.mydomain.db.bo.SurchargePK">
<key-property
name="surchargeCategory"
column="CATCD"
type="com.mydomain.db.TrimmedString"
length="1"
/>
<key-property
name="surchargeId"
column="SURCHGID"
type="com.mydomain.db.TrimmedString"
length="10"
/>
<key-property
name="effectiveTimestamp"
column="EFFTS"
type="java.sql.Timestamp"
length="26"
/>
</composite-id>
<timestamp
name="lastUpdateTimestamp"
column="UPDTS"
/>
<property
name="currentRow"
type="com.mydomaing.db.TrimmedString"
column="CURRIND"
not-null="true"
length="1"
/>