Hi all,
I'm hitting a problem when trying to create a one-to-many association on a column that is not the primary key. I have database 2 tables, Issuer and EquityRatio with the one-to-many from Issuer to EquityRatio. The column in Issuer is R1_TICKER and the column in EquityRatio is TICKER.
The problem we seem to be having is that when Hibernate is trying to map to the EquityRatio table it is passing in the primary key from Issuer instead of the R1_TICKER value. We can't seem to work out how to force Hibernate to use the R1_TICKER column instead of the primary key column. I've had a search on the forum but I can't find anything useful.
Any ideas? Full details below.
Rob
Hibernate version: 3.0
Mapping documents:
<set
name="equityRatios"
lazy="true"
cascade="none"
batch-size="10"
>
<key foreign-key="R1_TICKER" >
<column name="TICKER" />
</key>
<one-to-many
class="com.db.csa.domain.EquityRatio"
/>
</set
Full stack trace of any exception that occurs:
ORA-01722: invalid number ORA-02063: preceding line from CSATOR1
Name and version of the database you are using:
Oracle 9.2
The generated SQL (show_sql=true):
select equityrati0_.TICKER as TICKER__, equityrati0_.RATIO as RATIO__, equityrati0_.VALUE as VALUE__, equityrati0_.REPORT_YEAR as REPORT4___, equityrati0_.TICKER as TICKER0_, equityrati0_.RATIO as RATIO0_, equityrati0_.VALUE as VALUE0_, equityrati0_.REPORT_YEAR as REPORT4_0_ from V_EQUITY_RATIO equityrati0_ where equityrati0_.TICKER=?
|