Hi All,
            I have an inheritance relationship between my Product and Car
objects. New inserts of car objects work fine. The problem I'm experiencing
is that when I remove a car the corresponding product record is not being
removed from the product table. The mappings are shown below. I'm using
version db-ojb-1.0.4, the oscahce for caching, and the remote locking
implementation. Is there something wrong with my mappings? I've included my
stack trace so that you can observe that the car and all the relationships
are removed correctly, but not the product entry. Please advise.
 
Thank you,
Chris
 
Mappings:
 
<class-descriptor class="com.dm.beans.Product" schema="destinationdb"
table="product">
    <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" nullable="false" autoincrement="true"/>
    <field-descriptor name="supplierId" column="SUPPLIER_ID"
jdbc-type="INTEGER"/>
    <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR" />
    <field-descriptor name="ackOptLock" column="ACK_OPT_LOCK"
jdbc-type="BIGINT" locking="true"/>
    <reference-descriptor 
        name="supplier" 
        class-ref="com.dm.beans.suppliers.Supplier" 
        proxy="true" 
        auto-update="link" 
        auto-delete="none"
    >
        <foreignkey field-ref="supplierId"/>
    </reference-descriptor>
</class-descriptor>
 
<class-descriptor class="com.dm.beans.car.Car" schema="destinationdb"
table="car">
    <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" nullable="false"/>
    <field-descriptor name="modelId" column="MODEL_ID" jdbc-type="INTEGER"
/>
    <field-descriptor name="typeId" column="TYPE_ID" jdbc-type="INTEGER" />
    <field-descriptor name="largePassenger" column="LARGE_PASSENGER"
jdbc-type="INTEGER" />
    <field-descriptor name="mediumPassenger" column="MEDIUM_PASSENGER"
jdbc-type="INTEGER" />
    <field-descriptor name="smallPassenger" column="SMALL_PASSENGER"
jdbc-type="INTEGER" />
    <field-descriptor name="largeLuggage" column="LARGE_LUGGAGE"
jdbc-type="INTEGER" />
    <field-descriptor name="mediumLuggage" column="MEDIUM_LUGGAGE"
jdbc-type="INTEGER" />
    <field-descriptor name="smallLuggage" column="SMALL_LUGGAGE"
jdbc-type="INTEGER" />
    <field-descriptor name="quantity" column="QUANTITY" jdbc-type="INTEGER"
/>
    <field-descriptor name="allocation" column="ALLOCATION"
jdbc-type="INTEGER" />
    <field-descriptor name="ackOptLock" column="ACK_OPT_LOCK"
jdbc-type="BIGINT" locking="true"/>
    <reference-descriptor 
        name="super" 
        class-ref="com.dm.beans.Product"
    >
        <foreignkey field-ref="id"/>
    </reference-descriptor>
    <reference-descriptor 
        name="model" 
        class-ref="com.dm.beans.type.CarModel" 
        proxy="true" 
        auto-update="link" 
        auto-delete="false"
    >
        <foreignkey field-ref="modelId"/>
    </reference-descriptor>
    <reference-descriptor 
        name="type" 
        class-ref="com.dm.beans.type.CarType" 
        proxy="true" 
        auto-update="link" 
        auto-delete="false"
    >
        <foreignkey field-ref="typeId"/>
    </reference-descriptor>
    <collection-descriptor
         name="amenities"
 
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareList"
         element-class-ref="com.dm.beans.type.Amenity"
         auto-update="link"
         auto-delete="link"
         proxy="true"
         indirection-table="product_amenity"
      >
         <fk-pointing-to-this-class column="PRODUCT_ID"/>
         <fk-pointing-to-element-class column="AMENITY_ID"/>
    </collection-descriptor>
    <collection-descriptor
         name="mediaFiles"
 
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareList"
         element-class-ref="com.dm.beans.Multimedia"
         auto-update="link"
         auto-delete="link"
         proxy="true"
         indirection-table="product_multimedia"
      >
         <fk-pointing-to-this-class column="PRODUCT_ID"/>
         <fk-pointing-to-element-class column="MULTIMEDIA_ID"/>
    </collection-descriptor>
    <collection-descriptor
         name="rates"
 
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareList"
         element-class-ref="com.dm.beans.car.CarRate"
         auto-update="true"
         auto-delete="true"
         proxy="true"
    >
        <inverse-foreignkey field-ref="productId"/>
    </collection-descriptor>    
</class-descriptor>
 
Stack Trace:
 
2006-01-31 15:35:24,312 DEBUG implementations.CarDAOOJBImpl      - remove():
518
2006-01-31 15:35:24,312 DEBUG implementations.CarDAOOJBImpl      - remove():
[EMAIL PROTECTED]
  id=518
  supplierId=<null>
  name=<null>
  modelId=<null>
  typeId=<null>
  adults=<null>
  children=<null>
  infants=<null>
  largeLuggage=<null>
  mediumLuggage=<null>
  smallLuggage=<null>
  quantity=<null>
  allocation=<null>
]
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM product_amenity WHERE PRODUCT_ID=?
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeUpdateSQL:
DELETE FROM product_amenity WHERE PRODUCT_ID=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM product_multimedia WHERE PRODUCT_ID=?
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeUpdateSQL:
DELETE FROM product_multimedia WHERE PRODUCT_ID=?
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG:
getCollectionByQuery (class
org.apache.ojb.broker.util.collections.RemovalAwareList, class
com.dm.beans.car.CarRate, QueryByCriteria from class
com.dm.beans.car.CarRate  where [productId = 518])
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery:
QueryByCriteria from class com.dm.beans.car.CarRate  where [productId = 518]
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT
A0.ID,A0.CAR_ID,A0.START_DATE,A0.END_DATE,A0.COMMISSION,A0.DAY1,A0.DAY2,A0.D
AY3,A0.DAY4,A0.DAY5,A0.DAY6,A0.DAY7,A0.EXTRA,A0.ACK_OPT_LOCK FROM
destinationdb.car_rate A0 WHERE A0.CAR_ID = ?
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery:
[EMAIL PROTECTED]
[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG:
RsIterator[org.apache.ojb.broker.accesslayer.RsQueryObject[query:
QueryByCriteria from class com.dm.beans.car.CarRate  where [productId =
518], class descriptor: com.dm.beans.car.CarRate]] initialized
[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> true
[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> false
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete:
[EMAIL PROTECTED]
  id=29
  commission=21%
  day1=49.15
  day2=98.3
  day3=136.13
  day4=181.5
  day5=198.0
  day6=198.0
  day7=198.0
  extra=28.29
]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete:
[EMAIL PROTECTED]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete:
[EMAIL PROTECTED]
  id=518
  supplierId=173
  name=Daihatsu - Mini Moke
  modelId=61
  typeId=7
  adults=2
  children=2
  infants=0
  largeLuggage=0
  mediumLuggage=0
  smallLuggage=1
  quantity=2
  allocation=2
]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete:
[EMAIL PROTECTED]
 
 

Reply via email to