castor

in long transaction, changing a reference that have extends the saved value is set to null.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.3
  • Fix Version/s: 1.3.1
  • Component/s: JDO
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    4

Description

in a production system i'm getting:

org.exolab.castor.jdo.TransactionAbortedException: Nested error: org.exolab.castor.jdo.PersistenceException: Nested error: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-5005] (at 118): Missing non-NULL value: [-5005] (at 118): Missing non-NULL value: Nested error: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-5005] (at 118): Missing non-NULL value: [-5005] (at 118): Missing non-NULL value
at org.castor.persist.AbstractTransactionContext.prepare(AbstractTransactionContext.java:1198)
at org.exolab.castor.jdo.engine.LocalDatabaseImpl.commit(LocalDatabaseImpl.java:159)
at com.supridatta.bean.DataPersist.gravar(DataPersist.java:261)

but the object dont have a null value in that reference.

to better understand i will create a test case that contains follow classes:

Person() {
}

NaturalPerson() extends Person {
}

LegalPerson() extends Person {
}

Product() {
}

Motorcycle() extends Product {
Person holder;
Person reseller;
}

Invoice {
Person emitter;
Person billTo;
Vector<InvoiceItem> invoiceItem;
}
InvoiceItem {
Product product;
}

with this scenario in mind, the transaction that maybe throws that exception is:

1. Load all Motorcyle where holder is the reseller company.
2. Choose one of that Motorcycle.
3. In one transaction create an Invoice to sell this Motorcycle, and changes the holder to become the person that is on billTo of that Invoice.

at step 3 on commit we get the null pointer exception.

  1. patch-C2861-20091221.txt
    21/Dec/09 11:59 AM
    24 kB
    Clovis Wichoski
  2. patch-C2861-20091221-2.txt
    21/Dec/09 12:37 PM
    26 kB
    Clovis Wichoski
  3. patch-C2861-20091222.txt
    22/Dec/09 6:03 AM
    27 kB
    Clovis Wichoski
  4. patch-C2861-20091231.txt
    31/Dec/09 9:43 AM
    35 kB
    Ralf Joachim

Issue Links

Activity

Hide
Clovis Wichoski added a comment -

test case that simulates the problem, working for sapdb, ddl for other databases must be created.

Show
Clovis Wichoski added a comment - test case that simulates the problem, working for sapdb, ddl for other databases must be created.
Hide
Clovis Wichoski added a comment -

now, includes ddl for derby test too.

Show
Clovis Wichoski added a comment - now, includes ddl for derby test too.
Hide
Clovis Wichoski added a comment -

in AbstractTransactionContext class at line 541 returns objectInTx but dont populate proposedObject as expected in class PersistanceCapableRelationResolver from line 268, i populated proposedObject and now testcase works. and my production application too,

testcase with changes on AbstractTransactionContext attached.

Show
Clovis Wichoski added a comment - in AbstractTransactionContext class at line 541 returns objectInTx but dont populate proposedObject as expected in class PersistanceCapableRelationResolver from line 268, i populated proposedObject and now testcase works. and my production application too, testcase with changes on AbstractTransactionContext attached.
Hide
Ralf Joachim added a comment -

Final patch also tested against mysql and postgresql.

Show
Ralf Joachim added a comment - Final patch also tested against mysql and postgresql.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: