Hi!
I need to work with many-to-many associations with JDK 1.3. In the documentation I have read that the orderedSet functionality with the order-by attribute (resp. the sort attribute) is only available with JDK 1.4.
Is there a possibility with JDK1.3? In Hibernate in Action, it is mentioned that ordered bags are possible with all JDK versions. But it is not explained how to use them. So, I tried a list:
<list
name="suppliers"
lazy="true"
cascade="none"
table="V_SUPPLER_SITE_X"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
cascade="none"
table="V_SUPPLER_SITE_X"
@hibernate.collection-key
column="SITE_ID"
@hibernate.collection-many-to-many
class="com.kn.gvs.inv.integration.entities.Supplier"
column="SUPPLIER_ID"
</meta>
<key>
<column name="SITE_ID" />
</key>
<index column="NAME"/>
<many-to-many
class="com.kn.gvs.inv.integration.entities.Supplier"
>
<column name="SUPPLIER_ID" />
</many-to-many>
</list>
This does not work and I get the following error:
...
Caused by: java.sql.SQLException: ORA-00904: "SUPPLIERS0_"."NAME": invalid identifier
...
The SQL statement looks like this:
select
suppliers0_.SITE_ID as SITE_ID__,
suppliers0_.SUPPLIER_ID as SUPPLIER2___,
suppliers0_.NAME as NAME__,
supplier1_.SUPPLIER_ID as SUPPLIER1_0_,
supplier1_.SUPPLIER_NUMBER as SUPPLIER2_0_,
supplier1_.NAME as NAME0_ from V_SUPPLER_SITE_X suppliers0_,
V_SUPPLIER supplier1_
where
suppliers0_.SITE_ID=?
and suppliers0_.SUPPLIER_ID=supplier1_.SUPPLIER_ID
It seems to me that hibernate is searching for the column NAME in the bridge table. I don't know, if the real problem is, that NAME is also a normal property of the entity class. Can anyone help?
Best Regards,
Oliver
|