Joined: Fri May 14, 2004 5:38 pm Posts: 12
|
Hibernate version:2.1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.foo.TaxAllocation" table="TAX_ALLOCATION" mutable="false" lazy="true">
<composite-id>
<key-property name="participantId" column="PARTC_ID"/>
<key-property name="betaTradeSymbol" column="BETA_TRADE_SYM" />
<key-property name="taxCode" column="TAXCODE_NUM" />
</composite-id>
<property name="allocationPercentage" column="ALLOC_PC" />
<set name="taxRates" table="TAX_ALLOC_WITHHOLDING" lazy="true">
<key>
<column name="PARTC_ID" />
<column name="BETA_TRADE_SYM" />
<column name="TAXCODE_NUM" />
</key>
<composite-element class="com.foo.TaxRate">
<many-to-one name="taxCodeRate" class="com.schwab.sps.domain.TaxCodeRate" >
<column name="TAXCODE_NUM" />
<column name="RATE_TYPE" />
</many-to-one>
<property name="ammountWithheldYTD" column="ALLOC_WITHLD_YTD" />
<property name="withholdISO" column="ALLOC_WITHLD_ISO" type="boolean" />
<property name="withholdNQ" column="ALLOC_WITHLD_NQ" type="boolean" />
<property name="withholdRES" column="ALLOC_WITHLD_RES" type="boolean" />
<property name="withholdSAR" column="ALLOC_WITHLD_SAR" type="boolean" />
</composite-element>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Oracle 9
I am trying to map a legacy database which is really strangely set up. I have a many-to-many relationship between two objects. The association table has some data in it that I need as well.. so I am trying to set up a composite element type many-to-many mapping. THe problem is that foreign key to the first table is a compound key that shares one of it's components with the foreign key to the other table (no real foreign key constraints were created in the db). When I try to map it, hibernate complains that I have already used one of the columns. Is there any way to get hibernate to do this?
thanks!
joe
|
|