Sorry for not clearly stating my issue.
Here are the tables:
Code:
Table 1: participant
Column name Type Nulls
owner_number integer no
participant_id integer no
Table 2: particpant_addr
Code:
Column name Type Nulls
participant_id integer yes
owner_number integer yes
address_type char(1) yes
address_1 char(30) yes
address_2 char(30) yes
city char(20) yes
state char(10) yes
country char(25) yes
zip char(10) yes
Mapping:
Code:
<class name="Participant" table="participant" lazy="false">
<id name="participantId" type="integer" column="participant_id" unsaved-value="0">
<generator class="assigned" />
</id>
<set name="addresses" table="participant_addr" cascade="all,delete-orphan">
<key column="participant_id" />
<one-to-many class="ParticipantAddress" not-found="ignore" />
</set>
</class>
Code:
<class name="ParticipantAddress" table="participant_addr">
<composite-id>
<key-property name="ownerNumber" column="owner_number" />
<key-property name="participantId" column="participant_id" />
<key-property name="addressType" column="address_type" />
</composite-id>
<property name="address1" column="address_1" />
<property name="address2" column="address_2" />
<property name="city" column="city" />
<property name="state" column="state" />
<property name="country" column="country" />
<property name="zip" column="zip" />
</class>
After removing the inverse="true", I'm seeing the following error on delete of address object.
21:54:26 DEBUG could not delete collection rows: [com.xxx.applications.dbobjects.Participant.addresses#26116] [update informix.participant_addr set partic
ipant_id=null where participant_id=? and owner_number=? and participant_id=? and address_type=?]
java.sql.SQLException: [BEA][Informix JDBC Driver][Informix]Primary key on table (participant_addr) has a field with a null key value.
at weblogic.jdbcspy.SpyLogger.sqlException(Unknown Source)
at weblogic.jdbcspy.SpyPreparedStatement.executeUpdate(Unknown Source)
What I really want to see is the follwoing query:
delete from participant_addr where participant_id=? and owner_number=? and address_type=?
Thanks for the quick response!