db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/odmg MultiDBUsageTest.java
Date Sun, 05 Dec 2004 14:22:31 GMT
tomdz       2004/12/05 06:22:31

  Modified:    src/java/org/apache/ojb/odmg/collections DListImpl.java
                        DMapEntry.java DMapImpl.java DListEntry.java
                        DSetIterator.java DListIterator.java DSetImpl.java
                        DBagImpl.java
               src/java/org/apache/ojb/odmg ImplementationImpl.java
                        DatabaseImpl.java TransactionImpl.java
                        PBCapsule.java
               src/java/org/apache/ojb/odmg/oql OQLQueryImpl.java
               src/java/org/apache/ojb/otm/core BaseConnection.java
               .        release-notes.txt
               src/test/org/apache/ojb/odmg MultiDBUsageTest.java
  Log:
  Changed ODMG impl to be independent from the PersistenceBrokerFactory
  
  Revision  Changes    Path
  1.31      +19 -22    db-ojb/src/java/org/apache/ojb/odmg/collections/DListImpl.java
  
  Index: DListImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DListImpl.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- DListImpl.java	5 Dec 2004 12:31:00 -0000	1.30
  +++ DListImpl.java	5 Dec 2004 14:22:30 -0000	1.31
  @@ -24,11 +24,11 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.ojb.broker.ManageableCollection;
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerAware;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBrokerInternal;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.core.ValueContainer;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
  @@ -70,10 +70,7 @@
       private List elements;
       private int size;
       private OJBTxManager txManager;
  -    /**
  -     * PBKey this DList belongs to.
  -     */
  -    private PBKey pbKey;
  +    private transient PersistenceConfiguration persistenceConf;
   
       /**
        * Empty constructor for creating a list object from the database.
  @@ -129,17 +126,17 @@
           if ((tx != null) && tx.isOpen())
           {
               result = true;
  -            if (pbKey == null)
  +            if (persistenceConf == null)
               {
  -                pbKey = tx.getBroker().getPBKey();
  +                persistenceConf = tx.getBroker().getConfiguration();
               }
           }
           return result;
       }
   
  -    public PBKey getPBKey()
  +    public PersistenceConfiguration getPersistenceConfiguration()
       {
  -        if ((pbKey == null) && (txManager != null))
  +        if ((persistenceConf == null) && (txManager != null))
           {
               TransactionExt tx = txManager.getTransaction();
   
  @@ -148,12 +145,12 @@
                   checkForOpenTransaction(tx);
               }
           }
  -        return pbKey;
  +        return persistenceConf;
       }
   
  -    public void setPBKey(PBKey pbKey)
  +    public void setPersistenceConfiguration(PersistenceConfiguration persistenceConf)
       {
  -        this.pbKey = pbKey;
  +        this.persistenceConf = persistenceConf;
       }
   
       /**
  @@ -254,7 +251,7 @@
               entry.setPosition(i);
           }
   
  -        return entry.getRealSubject(getPBKey(), getTxManager());
  +        return entry.getRealSubject(getPersistenceConfiguration(), getTxManager());
       }
   
       /**
  @@ -270,7 +267,7 @@
       {
           DListImpl result = new DListImpl(txManager);
   
  -        result.setPBKey(getPBKey());
  +        result.setPersistenceConfiguration(getPersistenceConfiguration());
           result.addAll(this);
           result.addAll(otherList);
           return result;
  @@ -304,7 +301,7 @@
       {
           DListEntry entry = (DListEntry)elements.get(index);
   
  -        return entry.getRealSubject(getPBKey(), getTxManager());
  +        return entry.getRealSubject(getPersistenceConfiguration(), getTxManager());
       }
   
       /**
  @@ -380,7 +377,7 @@
               for (int i = 0; i < elements.size(); i++)
               {
                   DListEntry        entry    = (DListEntry)elements.get(i);
  -                Object            obj      = entry.getRealSubject(getPBKey(), getTxManager());
  +                Object            obj      = entry.getRealSubject(getPersistenceConfiguration(),
getTxManager());
                   ClassDescriptor   cld      = brokerForClass.getClassDescriptor(obj.getClass());
                   FieldDescriptor[] pkFields = cld.getPkFields();
                   ValueContainer[]  pkValues = brokerForClass.serviceBrokerHelper().getKeyValues(cld,
obj);
  @@ -414,7 +411,7 @@
       {
           // we ll have to compute the most general extent class here !!!
           DListEntry entry         = (DListEntry)elements.get(0);
  -        Class      elementsClass = entry.getRealSubject(getPBKey(), getTxManager()).getClass();
  +        Class      elementsClass = entry.getRealSubject(getPersistenceConfiguration(),
getTxManager()).getClass();
   
           return brokerForClass.getTopLevelClass(elementsClass);
       }
  @@ -432,7 +429,7 @@
           String oql = "select all from java.lang.Object where " + predicate;
   
           // TODO: Use a ObjectFactory to instantiate OQLQuery?
  -        OQLQuery predicateQuery = new OQLQueryImpl(pbKey, txManager, getClass());
  +        OQLQuery predicateQuery = new OQLQueryImpl(getPersistenceConfiguration(), txManager,
getClass());
   
           predicateQuery.create(oql);
   
  @@ -445,7 +442,7 @@
               throw new QueryInvalidException("Need running transaction to do query");
           }
   
  -        PBCapsule handle = new PBCapsule(pbKey, tx);
  +        PBCapsule handle = new PBCapsule(getPersistenceConfiguration(), tx);
           DList     result;
   
           try
  @@ -517,7 +514,7 @@
           ToStringBuilder buf = new ToStringBuilder(this);
   
           buf.append("id", id);
  -        buf.append("pbKey", pbKey);
  +        buf.append("persistenceConfiguration", persistenceConf);
           buf.append("size", size);
           buf.append("[containing elements: ");
   
  @@ -708,9 +705,9 @@
        */
       public void afterLookup(PersistenceBroker broker) throws PersistenceBrokerException
       {
  -        if (pbKey == null)
  +        if (persistenceConf == null)
           {
  -            pbKey = broker.getPBKey();
  +            persistenceConf = broker.getConfiguration();
           }
           if (txManager == null)
           {
  
  
  
  1.20      +14 -14    db-ojb/src/java/org/apache/ojb/odmg/collections/DMapEntry.java
  
  Index: DMapEntry.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DMapEntry.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DMapEntry.java	14 Nov 2004 09:37:40 -0000	1.19
  +++ DMapEntry.java	5 Dec 2004 14:22:30 -0000	1.20
  @@ -21,8 +21,8 @@
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.odmg.OJBTxManager;
  @@ -125,11 +125,11 @@
       /**
        * Returns the real key object.
        * 
  -     * @param pbKey     The broker key used by the owning collection
  -     * @param txManager The tx manager
  +     * @param persistenceConf The persistence configuration
  +     * @param txManager       The tx manager
        * @return The key object
        */
  -    public Object getRealKey(PBKey pbKey, OJBTxManager txManager)
  +    public Object getRealKey(PersistenceConfiguration persistenceConf, OJBTxManager txManager)
       {
           if (keyRealSubject != null)
           {
  @@ -145,9 +145,9 @@
               }
               else
               {
  -                if (pbKey != null)
  +                if (persistenceConf != null)
                   {
  -                    PBCapsule capsule = new PBCapsule(pbKey, null);
  +                    PBCapsule capsule = new PBCapsule(persistenceConf, null);
   
                       try
                       {
  @@ -176,7 +176,7 @@
           // so we now might have to load the object from the db
           if ((keyRealSubject == null) && (dmap != null))
           {
  -            return getRealKey(dmap.getPBKey(), dmap.getTxManager());
  +            return getRealKey(dmap.getPersistenceConfiguration(), dmap.getTxManager());
           }
           else
           {
  @@ -187,11 +187,11 @@
       /**
        * Returns the real value object.
        * 
  -     * @param pbKey     The broker key used by the owning collection
  -     * @param txManager The tx manager
  +     * @param persistenceConf The persistence configuration
  +     * @param txManager       The tx manager
        * @return The value object
        */
  -    public Object getRealValue(PBKey pbKey, OJBTxManager txManager)
  +    public Object getRealValue(PersistenceConfiguration persistenceConf, OJBTxManager txManager)
       {
           if (valueRealSubject != null)
           {
  @@ -207,9 +207,9 @@
               }
               else
               {
  -                if (pbKey != null)
  +                if (persistenceConf != null)
                   {
  -                    PBCapsule capsule = new PBCapsule(pbKey, null);
  +                    PBCapsule capsule = new PBCapsule(persistenceConf, null);
   
                       try
                       {
  @@ -238,7 +238,7 @@
           // so we now might have to load the object from the db
           if ((valueRealSubject == null) && (dmap != null))
           {
  -            return getRealValue(dmap.getPBKey(), dmap.getTxManager());
  +            return getRealValue(dmap.getPersistenceConfiguration(), dmap.getTxManager());
           }
           else
           {
  
  
  
  1.23      +13 -13    db-ojb/src/java/org/apache/ojb/odmg/collections/DMapImpl.java
  
  Index: DMapImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DMapImpl.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DMapImpl.java	14 Nov 2004 09:37:40 -0000	1.22
  +++ DMapImpl.java	5 Dec 2004 14:22:30 -0000	1.23
  @@ -19,11 +19,11 @@
   import java.util.AbstractMap;
   import java.util.Iterator;
   
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerAware;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBrokerInternal;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.util.collections.ManageableHashSet;
   import org.apache.ojb.odmg.OJBTxManager;
   import org.apache.ojb.odmg.TransactionExt;
  @@ -43,7 +43,7 @@
       private ManageableHashSet entries;
       private int size = 0;
       private OJBTxManager txManager;
  -    private PBKey pbKey;
  +    private PersistenceConfiguration persistenceConf;
   
       /**
        * Empty constructor for creating a map object from the database.
  @@ -68,14 +68,14 @@
           return txManager;
       }
       
  -    public PBKey getPBKey()
  +    public PersistenceConfiguration getPersistenceConfiguration()
       {
  -        return pbKey;
  +        return persistenceConf;
       }
   
  -    public void setPBKey(PBKey pbKey)
  +    public void setPersistenceConfiguration(PersistenceConfiguration persistenceConf)
       {
  -        this.pbKey = pbKey;
  +        this.persistenceConf = persistenceConf;
       }
   
       private boolean checkForOpenTransaction(TransactionExt tx)
  @@ -85,9 +85,9 @@
           if ((tx != null) && tx.isOpen())
           {
               result = true;
  -            if (pbKey == null)
  +            if (persistenceConf == null)
               {
  -                pbKey = tx.getBroker().getPBKey();
  +                persistenceConf = tx.getBroker().getConfiguration();
               }
           }
           return result;
  @@ -157,7 +157,7 @@
               {
                   DMapEntry e = (DMapEntry)i.next();
   
  -                if (e.getRealKey(getPBKey(), getTxManager()) == null)
  +                if (e.getRealKey(getPersistenceConfiguration(), getTxManager()) == null)
                   {
                       correctEntry = e;
                   }
  @@ -169,7 +169,7 @@
               {
                   DMapEntry e = (DMapEntry)i.next();
   
  -                if (key.equals(e.getRealKey(getPBKey(), getTxManager())))
  +                if (key.equals(e.getRealKey(getPersistenceConfiguration(), getTxManager())))
                   {
                       correctEntry = e;
                   }
  @@ -297,9 +297,9 @@
        */
       public void afterLookup(PersistenceBroker broker) throws PersistenceBrokerException
       {
  -        if (pbKey == null)
  +        if (persistenceConf == null)
           {
  -            pbKey = broker.getPBKey();
  +            persistenceConf = broker.getConfiguration();
           }
           if (txManager == null)
           {
  
  
  
  1.27      +29 -10    db-ojb/src/java/org/apache/ojb/odmg/collections/DListEntry.java
  
  Index: DListEntry.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DListEntry.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DListEntry.java	14 Nov 2004 09:37:40 -0000	1.26
  +++ DListEntry.java	5 Dec 2004 14:22:30 -0000	1.27
  @@ -18,13 +18,12 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.odmg.OJBTxManager;
   import org.apache.ojb.odmg.TransactionExt;
  -import org.apache.ojb.odmg.PBCapsule;
   
   import java.io.Serializable;
   
  @@ -105,11 +104,11 @@
       /**
        * Returns the real subject, i.e. the object stored in this entry.
        * 
  -     * @param pbKey     The broker key used by the owning collection
  -     * @param txManager The tx manager
  +     * @param persistenceConf The persistence configuration
  +     * @param txManager       The tx manager
        * @return The stored object
        */
  -    public Object getRealSubject(PBKey pbKey, OJBTxManager txManager)
  +    public Object getRealSubject(PersistenceConfiguration persistenceConf, OJBTxManager
txManager)
       {
           if (realSubject != null)
           {
  @@ -125,17 +124,37 @@
               }
               else
               {
  -                if (pbKey != null)
  +                if (persistenceConf != null)
                   {
  -                    PBCapsule capsule = new PBCapsule(pbKey, null);
  +                    boolean           needsPBCommit = false;
  +                    PersistenceBroker broker        = null;
   
                       try
                       {
  -                        prepareRealSubject(capsule.getBroker());
  +                        broker = persistenceConf.createPersistenceBroker();
  +
  +                        // begin tx on the PB instance
  +                        if (!broker.isInTransaction())
  +                        {
  +                            broker.beginTransaction();
  +                            needsPBCommit = true;
  +                        }
  +
  +                        prepareRealSubject(broker);
                       }
                       finally
                       {
  -                        capsule.destroy();
  +                        if (needsPBCommit)
  +                        {
  +                            try
  +                            {
  +                                broker.commitTransaction();
  +                            }
  +                            finally
  +                            {
  +                                if (broker != null) broker.close();
  +                            }
  +                        }
                       }
                   }
                   else
  
  
  
  1.10      +1 -1      db-ojb/src/java/org/apache/ojb/odmg/collections/DSetIterator.java
  
  Index: DSetIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DSetIterator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DSetIterator.java	14 Nov 2004 09:37:40 -0000	1.9
  +++ DSetIterator.java	5 Dec 2004 14:22:30 -0000	1.10
  @@ -61,7 +61,7 @@
       {
           currentEntry = ((DSetEntry)iter.next());
   
  -        return currentEntry.getRealSubject(dset.getPBKey(), dset.getTxManager());
  +        return currentEntry.getRealSubject(dset.getPersistenceConfiguration(), dset.getTxManager());
       }
   
       /**
  
  
  
  1.10      +3 -3      db-ojb/src/java/org/apache/ojb/odmg/collections/DListIterator.java
  
  Index: DListIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DListIterator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DListIterator.java	14 Nov 2004 09:37:40 -0000	1.9
  +++ DListIterator.java	5 Dec 2004 14:22:30 -0000	1.10
  @@ -124,7 +124,7 @@
       {
           currentEntry = (DListEntry)iter.next();
   
  -        return currentEntry.getRealSubject(dlist.getPBKey(), dlist.getTxManager());
  +        return currentEntry.getRealSubject(dlist.getPersistenceConfiguration(), dlist.getTxManager());
       }
   
       /**
  @@ -157,7 +157,7 @@
       {
           currentEntry = (DListEntry)iter.previous();
   
  -        return currentEntry.getRealSubject(dlist.getPBKey(), dlist.getTxManager());
  +        return currentEntry.getRealSubject(dlist.getPersistenceConfiguration(), dlist.getTxManager());
       }
   
       /**
  
  
  
  1.23      +20 -20    db-ojb/src/java/org/apache/ojb/odmg/collections/DSetImpl.java
  
  Index: DSetImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DSetImpl.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DSetImpl.java	14 Nov 2004 09:37:40 -0000	1.22
  +++ DSetImpl.java	5 Dec 2004 14:22:30 -0000	1.23
  @@ -21,11 +21,11 @@
   import java.util.Iterator;
   import java.util.List;
   
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerAware;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBrokerInternal;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.core.ValueContainer;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
  @@ -53,12 +53,12 @@
   public class DSetImpl extends AbstractSet implements DSet, PersistenceBrokerAware, Serializable
   {
   	private static final long serialVersionUID = -4459673364598652639L;
  -    private Logger log = LoggerFactory.getLogger(DSetImpl.class);
  +    private transient Logger log = LoggerFactory.getLogger(DSetImpl.class);
       private Integer id;
       private List elements;
       private int size;
       private OJBTxManager txManager;
  -    private PBKey pbKey;
  +    private transient PersistenceConfiguration persistenceConf;
   
       /**
        * An empty constructor for materializing from the database.
  @@ -85,18 +85,18 @@
       /**
        * DSetImpl constructor comment.
        */
  -    protected DSetImpl(OJBTxManager txManager, PBKey pbKey)
  +    protected DSetImpl(OJBTxManager txManager, PersistenceConfiguration persistenceConf)
       {
           super();
  -        this.txManager = txManager;
  -        this.elements  = new ArrayList();
  -        this.size      = 0;
  -        this.pbKey     = pbKey;
  +        this.txManager       = txManager;
  +        this.elements        = new ArrayList();
  +        this.size            = 0;
  +        this.persistenceConf = persistenceConf;
       }
   
  -    public PBKey getPBKey()
  +    public PersistenceConfiguration getPersistenceConfiguration()
       {
  -        return pbKey;
  +        return persistenceConf;
       }
   
       public OJBTxManager getTxManager()
  @@ -145,7 +145,7 @@
        */
       public org.odmg.DSet difference(org.odmg.DSet otherSet)
       {
  -        DSetImpl result = new DSetImpl(getTxManager(), getPBKey());
  +        DSetImpl result = new DSetImpl(getTxManager(), getPersistenceConfiguration());
   
           for (Iterator iter = this.iterator(); iter.hasNext();)
           {
  @@ -179,7 +179,7 @@
        */
       protected int generateNewId()
       {
  -        PBCapsule capsule = new PBCapsule(null, txManager.getTransaction());
  +        PBCapsule capsule = new PBCapsule(getPersistenceConfiguration(), txManager.getTransaction());
   
           try
           {
  @@ -221,7 +221,7 @@
       public org.odmg.DSet intersection(org.odmg.DSet otherSet)
       {
           DSet     union  = union(otherSet);
  -        DSetImpl result = new DSetImpl(getTxManager(), getPBKey());
  +        DSetImpl result = new DSetImpl(getTxManager(), getPersistenceConfiguration());
   
           for (Iterator iter = union.iterator(); iter.hasNext();)
           {
  @@ -283,9 +283,9 @@
       {
           // 1.build complete OQL statement
           String            oql            = "select all from java.lang.Object where " +
predicate;
  -        OQLQuery          predicateQuery = new OQLQueryImpl(pbKey, txManager, getClass());
  +        OQLQuery          predicateQuery = new OQLQueryImpl(getPersistenceConfiguration(),
txManager, getClass());
           TransactionExt    tx             = txManager.getTransaction();
  -        PBCapsule         capsule        = new PBCapsule(pbKey, tx);
  +        PBCapsule         capsule        = new PBCapsule(getPersistenceConfiguration(),
tx);
           PersistenceBroker broker         = capsule.getBroker();
   
           try
  @@ -329,7 +329,7 @@
               for (int i = 0; i < elements.size(); i++)
               {
                   DListEntry        entry    = (DListEntry)elements.get(i);
  -                Object            obj      = entry.getRealSubject(getPBKey(), getTxManager());
  +                Object            obj      = entry.getRealSubject(getPersistenceConfiguration(),
getTxManager());
                   ClassDescriptor   cld      = broker.getClassDescriptor(obj.getClass());
                   FieldDescriptor[] pkFields = cld.getPkFields();
                   ValueContainer[]  pkValues = broker.serviceBrokerHelper().getKeyValues(cld,
obj);
  @@ -364,7 +364,7 @@
       {
           // we ll have to compute the most general extent class here !!!
           DListEntry entry         = (DListEntry)elements.get(0);
  -        Class      elementsClass = entry.getRealSubject(getPBKey(), getTxManager()).getClass();
  +        Class      elementsClass = entry.getRealSubject(getPersistenceConfiguration(),
getTxManager()).getClass();
   
           return broker.getTopLevelClass(elementsClass);
       }
  @@ -455,7 +455,7 @@
        */
       public org.odmg.DSet union(org.odmg.DSet otherSet)
       {
  -        DSetImpl result = new DSetImpl(getTxManager(), getPBKey());
  +        DSetImpl result = new DSetImpl(getTxManager(), getPersistenceConfiguration());
   
           result.addAll(this);
           result.addAll(otherSet);
  @@ -538,9 +538,9 @@
        */
       public void afterLookup(PersistenceBroker broker) throws PersistenceBrokerException
       {
  -        if (pbKey == null)
  +        if (persistenceConf == null)
           {
  -            pbKey = broker.getPBKey();
  +            persistenceConf = broker.getConfiguration();
           }
           if (txManager == null)
           {
  
  
  
  1.9       +2 -2      db-ojb/src/java/org/apache/ojb/odmg/collections/DBagImpl.java
  
  Index: DBagImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/collections/DBagImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DBagImpl.java	14 Nov 2004 09:37:40 -0000	1.8
  +++ DBagImpl.java	5 Dec 2004 14:22:30 -0000	1.9
  @@ -60,7 +60,7 @@
           DBagImpl result = new DBagImpl();
   
           result.setTxManager(getTxManager());
  -        result.setPBKey(getPBKey());
  +        result.setPersistenceConfiguration(getPersistenceConfiguration());
           for (Iterator iter = this.iterator(); iter.hasNext();)
           {
               Object candidate = iter.next();
  @@ -88,7 +88,7 @@
           DBagImpl result = new DBagImpl();
   
           result.setTxManager(getTxManager());
  -        result.setPBKey(getPBKey());
  +        result.setPersistenceConfiguration(getPersistenceConfiguration());
           for (Iterator iter = otherBag.iterator(); iter.hasNext();)
           {
               Object candidate = iter.next();
  
  
  
  1.5       +10 -17    db-ojb/src/java/org/apache/ojb/odmg/ImplementationImpl.java
  
  Index: ImplementationImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/ImplementationImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ImplementationImpl.java	14 Nov 2004 09:37:20 -0000	1.4
  +++ ImplementationImpl.java	5 Dec 2004 14:22:30 -0000	1.5
  @@ -18,7 +18,6 @@
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.ojb.broker.util.logging.Logger;
  @@ -126,11 +125,6 @@
           return currentDatabase;
       }
   
  -    public PBKey getCurrentPBKey()
  -    {
  -        return currentDatabase.getPBKey();
  -    }
  -
       /**
        * Returns the transaction manager.
        * 
  @@ -210,7 +204,7 @@
               throw new DatabaseClosedException("Database is not open");
           }
   
  -        return new OQLQueryImpl(this.getCurrentPBKey(), txManager, oqlCollectionClass);
  +        return new OQLQueryImpl(currentDatabase.getPersistenceConfiguration(), txManager,
oqlCollectionClass);
       }
   
       /**
  @@ -296,16 +290,12 @@
   
           if (getCurrentDatabase() != null)
           {
  -            /**
  -             * is there an open database we are calling getObjectId against? if yes, use
it
  -             */
  -            broker = ojb.lookupBroker(getCurrentDatabase().getPBKey());
  +            // is there an open database we are calling getObjectId against? if yes, use
it
  +            broker = getCurrentDatabase().getPersistenceConfiguration().createPersistenceBroker();
           }
           else
           {
  -            /**
  -             * otherwise, use default.
  -             */
  +            // otherwise, use default
               broker = ojb.lookupBroker();
           }
   
  @@ -343,9 +333,12 @@
                   //ignore
               }
           }
  -        if (log.isDebugEnabled()) log.debug("Set current database " + newDB + " PBKey was
" + newDB.getPBKey());
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug("Set current database " + newDB + " with PBKey " + newDB.getPersistenceConfiguration().getKey());
  +        }
           setCurrentDatabase(newDB);
  -        usedDatabases.add(newDB.getPBKey());
  +        usedDatabases.add(newDB.getPersistenceConfiguration().getKey());
       }
   
       /**
  
  
  
  1.29      +20 -29    db-ojb/src/java/org/apache/ojb/odmg/DatabaseImpl.java
  
  Index: DatabaseImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/DatabaseImpl.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DatabaseImpl.java	14 Nov 2004 09:37:20 -0000	1.28
  +++ DatabaseImpl.java	5 Dec 2004 14:22:30 -0000	1.29
  @@ -15,11 +15,11 @@
    * limitations under the License.
    */
   
  +import org.apache.ojb.broker.ConfigurationException;
   import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.PBFactoryException;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.util.BrokerHelper;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  @@ -44,7 +44,7 @@
   {
       private Logger log = LoggerFactory.getLogger(DatabaseImpl.class);
   
  -    private PBKey pbKey;
  +    private PersistenceConfiguration persistenceConf;
       private boolean isOpen;
       private ImplementationImpl odmg;
       /**
  @@ -74,16 +74,15 @@
       }
   
       /**
  -     * Return the {@link org.apache.ojb.broker.PBKey} associated with this Database.
  +     * Return the {@link org.apache.ojb.broker.PersistenceConfiguration} associated with
this Database.
        */
  -    public PBKey getPBKey()
  +    public PersistenceConfiguration getPersistenceConfiguration()
       {
  -        if (pbKey == null)
  +        if (!isOpen)
           {
  -            log.error("## PBKey not set, Database isOpen=" + isOpen + " ##");
  -            if (!isOpen) throw new DatabaseClosedException("Database is not open");
  +            throw new DatabaseClosedException("Database is not open");
           }
  -        return pbKey;
  +        return persistenceConf;
       }
   
       /**
  @@ -93,7 +92,7 @@
        */
       public PersistenceBroker getBroker()
       {
  -        return odmg.getOJBRuntime().lookupBroker(getPBKey());
  +        return persistenceConf.createPersistenceBroker();
       }
   
       public boolean isOpen()
  @@ -120,37 +119,29 @@
           {
               throw new DatabaseOpenException("Database is already open");
           }
  -        PersistenceBroker broker = null;
           try
           {
               if (name == null)
               {
                   log.info("Given argument was 'null', open default database");
  -                broker = odmg.getOJBRuntime().lookupBroker();
  +                persistenceConf = odmg.getOJBRuntime().getConfiguration(null);
               }
               else
               {
  -                broker = odmg.getOJBRuntime().lookupBroker(BrokerHelper.extractAllTokens(name));
  +                persistenceConf = odmg.getOJBRuntime().getConfiguration(BrokerHelper.extractAllTokens(name));
               }
  -            pbKey = broker.getPBKey();
               isOpen = true;
               //register opened database
               odmg.registerOpenDatabase(this);
  -            if (log.isDebugEnabled()) log.debug("Open database using PBKey " + pbKey);
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("Open database using persistence configuration " + persistenceConf);
  +            }
           }
  -        catch (PBFactoryException ex)
  +        catch (ConfigurationException ex)
           {
               log.error("Open database failed: " + ex.getMessage(), ex);
  -            throw new DatabaseNotFoundException(
  -                    "OJB can't open database " + name + "\n" + ex.getMessage());
  -        }
  -        finally
  -        {
  -            // broker must be immediately closed
  -            if (broker != null)
  -            {
  -                broker.close();
  -            }
  +            throw new DatabaseNotFoundException("OJB can't open database " + name + "\n"
+ ex.getMessage());
           }
       }
   
  @@ -186,8 +177,8 @@
               throw ex;
           }
           isOpen = false;
  -        // remove the current PBKey
  -        pbKey = null;
  +        // release the configuration reference
  +        persistenceConf = null;
           // if we close current database, we have to notify implementation instance
           if (this == odmg.getCurrentDatabase())
           {
  
  
  
  1.69      +2 -3      db-ojb/src/java/org/apache/ojb/odmg/TransactionImpl.java
  
  Index: TransactionImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/TransactionImpl.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- TransactionImpl.java	5 Dec 2004 12:31:01 -0000	1.68
  +++ TransactionImpl.java	5 Dec 2004 14:22:30 -0000	1.69
  @@ -1116,8 +1116,7 @@
               }
               catch (PBFactoryException e)
               {
  -                log.error("Cannot obtain PersistenceBroker from PersistenceBrokerFactory,
" +
  -                        "found PBKey was " + curDB.getPBKey(), e);
  +                log.error("Cannot obtain PersistenceBroker from database object", e);
                   throw new PersistenceBrokerException(e);
               }
           }
  
  
  
  1.7       +24 -46    db-ojb/src/java/org/apache/ojb/odmg/PBCapsule.java
  
  Index: PBCapsule.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/PBCapsule.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PBCapsule.java	4 Apr 2004 23:53:38 -0000	1.6
  +++ PBCapsule.java	5 Dec 2004 14:22:30 -0000	1.7
  @@ -1,10 +1,8 @@
   package org.apache.ojb.odmg;
   
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.PBFactoryException;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.odmg.Transaction;
  @@ -25,40 +23,47 @@
    */
   public final class PBCapsule
   {
  -    private static Logger log = LoggerFactory.getLogger(PBCapsule.class);
  +    private Logger log = LoggerFactory.getLogger(PBCapsule.class);
   
  -    PersistenceBroker broker;
  -    PBKey pbKey;
  -    Transaction tx;
  -    boolean needsTxCommit = false;
  -    boolean needsPBCommit = false;
  -    boolean isIlleagal = false;
  +    private PersistenceConfiguration persistenceConf;
  +    private Transaction tx;
  +    private PersistenceBroker broker;
  +    private boolean needsTxCommit = false;
  +    private boolean needsPBCommit = false;
  +    private boolean isIllegal = false;
   
  -    public PBCapsule(final PBKey pbKey, final Transaction tx)
  +    public PBCapsule(PersistenceConfiguration persistenceConf, Transaction tx)
       {
           this.tx = tx;
  -        this.pbKey = pbKey;
  +        this.persistenceConf = persistenceConf;
           prepare();
       }
   
       public PersistenceBroker getBroker()
       {
  -        if(isIlleagal) throw new OJBRuntimeException("You could not reuse PBCapsule after
destroy");
  +        if (isIllegal)
  +        {
  +            throw new OJBRuntimeException("You could not reuse PBCapsule after destroy");
  +        }
           return broker;
       }
   
       private void prepare()
       {
  -        if(isIlleagal) throw new OJBRuntimeException("You could not reuse PBCapsule after
destroy");
  +        if (isIllegal)
  +        {
  +            throw new OJBRuntimeException("You could not reuse PBCapsule after destroy");
  +        }
           // we allow queries even if no ODMG transaction is running.
           // thus we use direct access to PBF via the given PBKey to
           // get a PB instance
           if (tx == null)
           {
               if (log.isDebugEnabled())
  -                log.debug("No running transaction found, try to get " +
  -                        "PersistenceBroker instance via PBKey " + pbKey);
  -            broker = obtainBroker();
  +            {
  +                log.debug("No running transaction found, try to get PersistenceBroker instance
from configuration " + persistenceConf);
  +            }
  +            broker = persistenceConf.createPersistenceBroker();
               // begin tx on the PB instance
               if (!broker.isInTransaction())
               {
  @@ -76,7 +81,7 @@
                   needsTxCommit = true;
               }
               // obtain a broker instance from the current transaction
  -            broker = ((HasBroker) tx).getBroker();
  +            broker = ((HasBroker)tx).getBroker();
           }
       }
   
  @@ -99,35 +104,8 @@
                   if (broker != null) broker.close();
               }
           }
  -        isIlleagal = true;
  +        isIllegal = true;
           needsTxCommit = false;
           needsPBCommit = false;
  -    }
  -
  -    /**
  -     * Used to get PB, when no tx is running.
  -     */
  -    private PersistenceBroker obtainBroker()
  -    {
  -        PersistenceBroker _broker;
  -        try
  -        {
  -            if (pbKey == null)
  -            {
  -                //throw new OJBRuntimeException("Not possible to do action, cause no tx
runnning and no PBKey is set");
  -                log.warn("No tx runnning and PBKey is null, try to use the default PB");
  -                _broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  -            }
  -            else
  -            {
  -                _broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  -        }
  -        catch (PBFactoryException e)
  -        {
  -            log.error("Could not obtain PB for PBKey " + pbKey, e);
  -            throw new OJBRuntimeException("Unexpected micro-kernel exception", e);
  -        }
  -        return _broker;
       }
   }
  
  
  
  1.21      +5 -5      db-ojb/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java
  
  Index: OQLQueryImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- OQLQueryImpl.java	5 Dec 2004 12:31:01 -0000	1.20
  +++ OQLQueryImpl.java	5 Dec 2004 14:22:31 -0000	1.21
  @@ -18,8 +18,8 @@
   import antlr.RecognitionException;
   import antlr.TokenStreamException;
   import org.apache.ojb.broker.ManageableCollection;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.accesslayer.OJBIterator;
   import org.apache.ojb.broker.query.BetweenCriteria;
   import org.apache.ojb.broker.query.Criteria;
  @@ -58,13 +58,13 @@
        */
       private Query query = null;
       private ListIterator bindIterator = null;
  -    private PBKey pbKey;
  +    private PersistenceConfiguration persistenceConf;
       /** The transaction manager */
       private OJBTxManager txManager;
   
  -    public OQLQueryImpl(PBKey key, OJBTxManager txManager, Class collectionClass)
  +    public OQLQueryImpl(PersistenceConfiguration persistenceConf, OJBTxManager txManager,
Class collectionClass)
       {
  -        this.pbKey           = key;
  +        this.persistenceConf = persistenceConf;
           this.txManager       = txManager;
           this.collectionClass = collectionClass;
       }
  @@ -237,7 +237,7 @@
   
           try
           {
  -            capsule = new PBCapsule(pbKey, tx);
  +            capsule = new PBCapsule(persistenceConf, tx);
               PersistenceBroker broker = capsule.getBroker();
   
               // ask the broker to perfom the query.
  
  
  
  1.41      +3 -3      db-ojb/src/java/org/apache/ojb/otm/core/BaseConnection.java
  
  Index: BaseConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/BaseConnection.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- BaseConnection.java	14 Nov 2004 09:39:57 -0000	1.40
  +++ BaseConnection.java	5 Dec 2004 14:22:31 -0000	1.41
  @@ -388,7 +388,7 @@
           checkTransaction("newOQLQuery");
   
           // TODO: How do we get the oqlCollectionClass value
  -        return new OTMOQLQueryImpl(_pb.getPBKey(), DListImpl.class, lock);
  +        return new OTMOQLQueryImpl(_pb.getConfiguration(), DListImpl.class, lock);
       }
   
       public int getCount(Query query)
  @@ -603,10 +603,10 @@
       {
           int _lock;
   
  -        public OTMOQLQueryImpl(PBKey key, Class collectionClass, int lock)
  +        public OTMOQLQueryImpl(PersistenceConfiguration persistenceConf, Class collectionClass,
int lock)
           {
               // no transaction manager because we override the execute method anyway
  -            super(key, null, collectionClass);
  +            super(persistenceConf, null, collectionClass);
               _lock = lock;
           }
   
  
  
  
  1.70      +3 -1      db-ojb/release-notes.txt
  
  Index: release-notes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/release-notes.txt,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- release-notes.txt	3 Dec 2004 21:59:17 -0000	1.69
  +++ release-notes.txt	5 Dec 2004 14:22:31 -0000	1.70
  @@ -11,6 +11,8 @@
   Release 1.1_alpha
   ---------------------------------------------------------------------
   NEW FEATURES:
  +- ManageableCollection interface has been extended: all ojb... Methods now also receive
a
  +  PersistenceBroker instance
   - Forward-port from 1.0 stable:
     New ant-target ojb-quickstart creates archives of ready-to-run apps for tutorials 1 and
2
     complete with pre-created Hsqldb databases (based on ojb-blank).
  
  
  
  1.13      +18 -18    db-ojb/src/test/org/apache/ojb/odmg/MultiDBUsageTest.java
  
  Index: MultiDBUsageTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/MultiDBUsageTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- MultiDBUsageTest.java	14 Nov 2004 09:42:54 -0000	1.12
  +++ MultiDBUsageTest.java	5 Dec 2004 14:22:31 -0000	1.13
  @@ -1,8 +1,8 @@
   package org.apache.ojb.odmg;
   
   import org.apache.ojb.broker.FarAwayClass;
  -import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.metadata.MetadataManager;
   import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
  @@ -109,9 +109,9 @@
           if(ojbSkipKnownIssueProblem()) return;
   
           // little hack for the test. use PB and ODMG api to verify results
  -        int odmgZoosBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(),
ODMGZoo.class);
  -        int projectsBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(),
Project.class);
  -        int farAwaysBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPBKey(),
FarAwayClass.class);
  +        int odmgZoosBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
ODMGZoo.class);
  +        int projectsBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
Project.class);
  +        int farAwaysBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPersistenceConfiguration(),
FarAwayClass.class);
   
           Transaction tx_1 = odmg_1.newTransaction();
           tx_1.begin();
  @@ -131,9 +131,9 @@
           storeObjects(tx_2, getNewFarAways(11));
           tx_2.commit();
   
  -        int odmgZoosAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(),
ODMGZoo.class);
  -        int projectsAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(),
Project.class);
  -        int farAwaysAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPBKey(),
FarAwayClass.class);
  +        int odmgZoosAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
ODMGZoo.class);
  +        int projectsAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
Project.class);
  +        int farAwaysAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPersistenceConfiguration(),
FarAwayClass.class);
           int odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg_1, ODMGZoo.class);
           int projectsAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg_1, Project.class);
           int farAwaysAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg_2, FarAwayClass.class);
  @@ -149,9 +149,9 @@
           // we do twice
           //************
           // little hack for the test
  -        odmgZoosBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(), ODMGZoo.class);
  -        projectsBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(), Project.class);
  -        farAwaysBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPBKey(), FarAwayClass.class);
  +        odmgZoosBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
ODMGZoo.class);
  +        projectsBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
Project.class);
  +        farAwaysBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPersistenceConfiguration(),
FarAwayClass.class);
   
           tx_1.begin();
           //store
  @@ -169,9 +169,9 @@
           storeObjects(tx_2, getNewFarAways(11));
           tx_2.commit();
   
  -        odmgZoosAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(), ODMGZoo.class);
  -        projectsAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(), Project.class);
  -        farAwaysAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPBKey(), FarAwayClass.class);
  +        odmgZoosAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
ODMGZoo.class);
  +        projectsAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
Project.class);
  +        farAwaysAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPersistenceConfiguration(),
FarAwayClass.class);
           odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg_1, ODMGZoo.class);
           projectsAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg_1, Project.class);
           farAwaysAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg_2, FarAwayClass.class);
  @@ -197,9 +197,9 @@
           deleteObjects(db_2, getAllObjects(odmg_2, FarAwayClass.class));
           tx_2.commit();
   
  -        int odmgZoosAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(),
ODMGZoo.class);
  -        int projectsAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(),
Project.class);
  -        int farAwaysAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPBKey(),
FarAwayClass.class);
  +        int odmgZoosAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
ODMGZoo.class);
  +        int projectsAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPersistenceConfiguration(),
Project.class);
  +        int farAwaysAfter = getDBObjectCountWithNewPB(((DatabaseImpl) db_2).getPersistenceConfiguration(),
FarAwayClass.class);
           //
           int odmgZoosAfterOQL = getDBObjectCountViaOqlQuery(odmg_1, ODMGZoo.class);
           int projectsAfterOQL = getDBObjectCountViaOqlQuery(odmg_1, Project.class);
  @@ -288,9 +288,9 @@
           return fa;
       }
   
  -    protected int getDBObjectCountWithNewPB(PBKey pbKey, Class target) throws Exception
  +    protected int getDBObjectCountWithNewPB(PersistenceConfiguration persistenceConf, Class
target) throws Exception
       {
  -        PersistenceBroker broker = ojb.getConfiguration(pbKey).createPersistenceBroker();
  +        PersistenceBroker broker = persistenceConf.createPersistenceBroker();
           Criteria c = new Criteria();
           Query q = new QueryByCriteria(target, c);
           int count = broker.getCount(q);
  
  
  

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


Mime
View raw message