db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abhay bhavsar <abhay.bhav...@nsc.com>
Subject [OJB] Issue #OJB138 - Changes not saved when calling commit() after object obtaine...
Date Tue, 04 Mar 2003 21:08:35 GMT
You can view the issue detail at the following URL:
<http://scarab.werken.com/scarab/issues/id/OJB138>

Type :        Defect
Issue Id :    OJB138
Reported by: abhay bhavsar
             abhaybhavsar - (abhay.bhavsar@nsc.com)

Details:

Platform: PC
Operating system: windows 2000
Summary: Changes not saved when calling commit() after object obtained from the Query are
modified.
Description: // The query returns both the Product and the newly 
// added ChildTest reference-descriptor but after making 
// them "dirty" does not save changes to the database 
// on a commit. No exception is raised.
// Using JDO API
// Exception Handling & indentation removed for redability.

Transaction tx = null;
tx = manager.currentTransaction();

tx.begin();

// Filter by product name
String filter="name==name_value";

// Query
Query q = manager.newQuery(Product.class, filter);
String parameter = "String name_value";
q.declareParameters(parameter);
Collection c = (Collection)q.execute( "L23456" );

// Iterate through the resultSet
Iterator itTasklog = c.iterator();
while(itTasklog.hasNext())
{
  // Obtain the object.
  // This has a reference-descriptor that point to the warehouse location.
  Product toBeEdited = ( Product) itTasklog.next();
  /*
   Identity oid = (Identity ) manager.getObjectId( toBeEdited );
   toBeEdited = ( Product) manager.getObjectById( oid, false );
  */

  if (toBeEdited == null)
  {
    System.out.println("did not find a matching instance...");
  }
  else
  {
    System.out.println( "found product->"+ toBeEdited );
    System.out.println( "found child warehouse location->"+ toBeEdited.getChildTest() );
    toBeEdited.setPrice(1.56);
    toBeEdited.setStock(54654);
    toBeEdited.getChildTest().setCity("Santa Clara");
    toBeEdited.getChildTest().setCountry("USA");
   }
}
tx.commit();
manager.close();
Status: New
Priority: High
Vote: High
Severity: Critical
Functional area: UI


Mime
View raw message