db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/jdori/org/apache/ojb/tutorial5 UCDeleteProduct.java UCEditProduct.java
Date Sun, 30 Mar 2003 20:11:34 GMT
thma        2003/03/30 12:11:34

  Modified:    src/jdori/org/apache/ojb/tutorial5 UCDeleteProduct.java
                        UCEditProduct.java
  Log:
  repair jdo tutorial
  
  Revision  Changes    Path
  1.3       +4 -5      db-ojb/src/jdori/org/apache/ojb/tutorial5/UCDeleteProduct.java
  
  Index: UCDeleteProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/tutorial5/UCDeleteProduct.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCDeleteProduct.java	9 Mar 2003 09:25:28 -0000	1.2
  +++ UCDeleteProduct.java	30 Mar 2003 20:11:34 -0000	1.3
  @@ -6,12 +6,11 @@
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
  +import org.apache.ojb.broker.PersistenceBrokerFactory;
   
   /**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author: Administrator
  + * Usecase for deleting a Product entry
  + * @author: Thomas Mahler
    */
   public class UCDeleteProduct extends AbstractUseCase
   {
  @@ -39,7 +38,7 @@
           // 1. build an example object with matching primary key values:
           Product example = new Product();
           example.setId(id);
  -        PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           Identity oid = new Identity(example, broker);
           try
           {
  
  
  
  1.5       +8 -4      db-ojb/src/jdori/org/apache/ojb/tutorial5/UCEditProduct.java
  
  Index: UCEditProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/tutorial5/UCEditProduct.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UCEditProduct.java	9 Mar 2003 09:25:28 -0000	1.4
  +++ UCEditProduct.java	30 Mar 2003 20:11:34 -0000	1.5
  @@ -1,10 +1,11 @@
   package org.apache.ojb.tutorial5;
   import javax.jdo.PersistenceManagerFactory;
   import javax.jdo.PersistenceManager;
  +//import javax.jdo.Query;
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
  +import org.apache.ojb.broker.PersistenceBrokerFactory;
   
   /**
    *
  @@ -38,14 +39,17 @@
              // 1. Build a query to look up product with the id
   
   			manager = factory.getPersistenceManager();
  -
  -            //Query query = manager.newQuery(Product.class, "id == " + id);
  +            
               Product example = new Product();
               example.setId(id);
  -            PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +            PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
               Identity oid = new Identity(example, broker);
               
               manager.currentTransaction().begin();
  +            
  +            //Query query = manager.newQuery(Product.class, "id == " + id);
  +            //toBeEdited = (Product) query.execute();
  +            
               toBeEdited = (Product) manager.getObjectById(oid, false);
               if (toBeEdited == null)
               {
  
  
  

Mime
View raw message