Beginner |
|
Joined: Tue Oct 07, 2003 4:41 am Posts: 21
|
Hibernate version:
2.1.4
Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="ims.domain.lookups.LookupInstance" table="lookup_instance" lazy="true">
<cache usage="nonstrict-read-write" />
<composite-id>
<key-property name="instId" type="integer" column="id" access="field"/>
<key-many-to-one name="type" class="ims.domain.lookups.Lookup" column="type" access="field"/>
</composite-id>
<property name="active" type="boolean" not-null="true" access="field"/>
<property name="text" type="string" access="field"/>
<property name="image" column="imagefile" type="integer" access="field"/>
<property name="color" type="string" access="field">
<column name="color" length="60" />
</property>
<!-- Set mappings -->
<set name="mappings" table="lookup_instance_mapping" lazy="true" access="field">
<key>
<column name="lkt_id" unique-key="lookup_mapping_idx1"/>
<column name="lkt_type" unique-key="lookup_mapping_idx1"/>
</key>
<composite-element class="ims.domain.lookups.LookupMapping">
<parent name="lookupInstance"/>
<property name="extSystem" access="field" type="string" >
<column name="extsystem" length="30" not-null="true" unique-key="lookup_mapping_idx1"/>
</property>
<property name="extCode" access="field" type="string" >
<column name="extcode" length="30" not-null="true" unique-key="lookup_mapping_idx1"/>
</property>
<property name="readTerm" access="field" not-null="false" column="readterm" type="string" length="5"/>
</composite-element>
</set>
<many-to-one name="parent" class="ims.domain.lookups.LookupInstance" unique="true" access="field">
<column name="lkt_id_parent"/>
<column name="lkt_type_parent"/>
</many-to-one>
<property name="order" column="c_order" type="integer" not-null="true" access="field"/>
</class>
</hibernate-mapping>
Name and version of the database you are using:
ASE 12.5 and Oracle 9i both on Windows 2000 server
The generated SQL (show_sql=true):
delete from lookup_instance_mapping where lkt_id=? and lkt_type=? and extsystem=? and extcode=? and readterm=?
I have an instance of the class LookupInstance which has a collection of LookupMapping's which are component classes. Only the readTerm property allows null.
Most of the time the readTerm property is null in new LookupMapping instances.
The logical (natural) unique key for the LookupMapping is the 4 other columns combined.
I can add new LookupMapping instances to the collection fine, but when it comes to deleting them I've a problem.
The where clause being generated by Hibernate for the delete statement includes the readterm column. When this runs against Sybase the row get's deleted, but when it runs against Oracle no rows are deleted.
Is there any way I can get Hibernate to NOT include readterm in the where clause for the delete? Or is there some other simpler explanation why the row is not deleted for Oracle?
Thanks
John
|
|