You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by balza <ba...@inwind.it> on 2003/11/02 23:32:14 UTC

Inheritance & delete

Hello,
sometime I'm back with the same question:
I've 2 tables  Transaction and ShopTransaction. ShopTransaction extends 
Transaction.

I've the code
public void apply() {
        logger.debug("apply");
        logger.debug("transaction_id :" + transaction_id);
        transaction = new ShopTransaction();       
        transaction.setTransaction_id(transaction_id);       
        Criteria crit = new Criteria();
        crit.addEqualTo("transaction_id", new Integer(transaction_id));
        Query query = QueryFactory.newQuery(ShopTransaction.class,crit);

        broker.beginTransaction();
        broker.delete(transaction);
        broker.commitTransaction();
}

I've the log
310  [main] DEBUG mascheroni.vendite.UCRollbackShopTransaction  - 
transaction_id :2041
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete 
: mascheroni.vendite.ShopTransaction@cf66b
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete: 
com.mysql.jdbc.PreparedStatement@1060478: DELETE FROM v4s_transaction 
WHERE transaction_id = 2022
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete 
: allibo.commerce.Transaction@f9c40
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete: 
com.mysql.jdbc.PreparedStatement@db4fa2: DELETE FROM fCO_transaction 
WHERE transaction_id = 2042

Why?!?!?!!

This time  I hope someone could help me





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Inheritance & delete

Posted by Danilo Tommasina <dt...@risksys.com>.
Hi,

did you declare ShopTransaction as extent-class in the class-descriptor 
of Transaction? If ShopTransaction and Transaction are to be considered 
as different entities, then you should not declare ShopTransaction as 
extent of Transaction in your repository.xml (in Java is Ok). If you did 
not declare ShopTransaction as extent-class then I guess it is an OJB 
bug, however somebody with more exp. than me could be of more help.

bye
danilo

> Hello,
> sometime I'm back with the same question:
> I've 2 tables  Transaction and ShopTransaction. ShopTransaction extends 
> Transaction.
> 
> I've the code
> public void apply() {
>        logger.debug("apply");
>        logger.debug("transaction_id :" + transaction_id);
>        transaction = new ShopTransaction();              
> transaction.setTransaction_id(transaction_id);              Criteria 
> crit = new Criteria();
>        crit.addEqualTo("transaction_id", new Integer(transaction_id));
>        Query query = QueryFactory.newQuery(ShopTransaction.class,crit);
> 
>        broker.beginTransaction();
>        broker.delete(transaction);
>        broker.commitTransaction();
> }
> 
> I've the log
> 310  [main] DEBUG mascheroni.vendite.UCRollbackShopTransaction  - 
> transaction_id :2041
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete 
> : mascheroni.vendite.ShopTransaction@cf66b
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete: 
> com.mysql.jdbc.PreparedStatement@1060478: DELETE FROM v4s_transaction 
> WHERE transaction_id = 2022
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete 
> : allibo.commerce.Transaction@f9c40
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeDelete: 
> com.mysql.jdbc.PreparedStatement@db4fa2: DELETE FROM fCO_transaction 
> WHERE transaction_id = 2042
> 
> Why?!?!?!!
> 
> This time  I hope someone could help me
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 


-- 
Danilo Tommasina, Dipl. Ing. FH Telecom
Software Engineer
RCS Riskmanagement Concepts Systems AG
Technoparkstrasse 1
CH-8005 Zuerich
T: +41 1 445 29 08
dtommasina@risksys.com
www.risksys.com


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org