hhuber wrote:
What about showing us some DDL and perhaps the mappings you have so far.
Then it would be a lot easier to talk about the structure of the data.
alright lets try:
the card vendor:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name='works.supplier.db.HCardVendor' table='su_card_merchant_info'>
<id name='id' column='su_card_merchant_id'>
<generator class='identity'/>
</id>
<property name='name' column='su_supplier_name'/>
<property name='city' column='su_city'/>
<property name='state' column='su_state'/>
<property name='postalCode' column='su_postal_code'/>
<property name='mcc' column='su_mcc'/>
<property name='addr1' column='su_addr1'/>
<property name='womenOwned' column='su_b_women_owned'/>
<property name='hash' column='su_hash'/>
<!-- join table="HCompanySupplier"
inverse="true"
optional="true">
<key column="su_card_merchant_id"/>
<many-to-one name="su_rollup_xref"
column="personId"
not-null="true"/>
</join-->
</class>
</hibernate-mapping>
the company supplier:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name='works.supplier.db.HCompanySupplier'
table='su_supplier_rollup'>
<id name='id' column='sr_rollup_id'>
<generator class='identity' />
</id>
<property name='name' column='sr_name' />
<property name='companyId' column='sr_company_id' />
<property name='active' column='sr_active' />
<set name="cardVendors" table='su_rollup_xref' lazy='true'>
<key>
<column name="su_card_merchant_id" />
</key>
<many-to-many unique='true'
class="works.supplier.db.HCardVendor">
<column name='sr_rollup_id'></column>
<formula>'sr_company_id = su_supplier_rollup.sr_company_id'</formula>
</many-to-many>
</set>
<!--set name="cardVendors" table="su_xref_id" lazy="true">
<key column="sr_rollup_id">
<composite-element class="eg.works.supplier.db.CardVendor">
<many-to-one name="purchaseDetails' class="eg.Purchase"/>
<many-to-one name="item" class="eg.Item"/>
</composite-element>
</set-->
</class>
</hibernate-mapping>
the datalayer is
Code:
su_card_merchant_info(su_card_merchant_id [long, unique])
su_rollup_xref (su_xref_id,
su_card_merchant_id, [fkey to su_card_merchant_info]
sr_rollup_id, [fkey to su_supplier_rollup]
sr_company_id [denormalized to improve performance from su_supplier_rollup]
su_supplier_rollup (sr_rollup_id [long unique],
sr_company_id [int, really just a piece of data]
)
also one card vendor can be mapped to n su_supplier_rollups, an su_supplier_rollup is considered unique if it's name and company_id are a unique combination.
I can get the mapping to almost work, but cannot get the hibernate datalayer to add the company ID to the su_rollup_xref table.
Thanks,
Nathan
)[/code][/quote]