db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mka...@apache.org
Subject svn commit: r527484 - in /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker: core/PersistenceBrokerImpl.java util/sequence/SequenceManagerHelper.java
Date Wed, 11 Apr 2007 13:20:19 GMT
Author: mkalen
Date: Wed Apr 11 06:20:18 2007
New Revision: 527484

URL: http://svn.apache.org/viewvc?view=rev&rev=527484
Log:
Reimplement default sequence manager (fix regression if no explicit SequenceDescriptor / <sequence-manager/>).

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java?view=diff&rev=527484&r1=527483&r2=527484
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
Wed Apr 11 06:20:18 2007
@@ -221,7 +221,7 @@
         SequenceDescriptor sd = serviceConnectionManager().getConnectionDescriptor().getSequenceDescriptor();
         if(logger.isDebugEnabled()) logger.debug("Create sequence manager for descriptor:
" + sd);
         sequenceManager = SequenceManagerHelper.createManager(this, sd);
-        if(sd.isPerFieldSequences())
+        if(sd != null && sd.isPerFieldSequences())
         {
             if(logger.isDebugEnabled()) logger.debug("Enable per field sequence manager declaration");
             sequenceManager = new PerFieldManager(this, sequenceManager);
@@ -1914,7 +1914,7 @@
     {
         store(obj, mod, false);
     }
-    
+
     public void store(Object obj, ObjectModification mod, boolean ignoreReferences) throws
PersistenceBrokerException
     {
         obj = extractObjectToStore(obj);
@@ -2382,8 +2382,8 @@
 
     /**
      * Creates a proxy instance.
-     * 
-     * @param baseClassForProxy  The base class that the Proxy should extend. For dynamic
Proxies, the method of 
+     *
+     * @param baseClassForProxy  The base class that the Proxy should extend. For dynamic
Proxies, the method of
      *                           generation is dependent on the ProxyFactory implementation.
      * @param realSubjectsIdentity The identity of the subject
      * @return An instance of the proxy subclass

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java?view=diff&rev=527484&r1=527483&r2=527484
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
Wed Apr 11 06:20:18 2007
@@ -517,10 +517,18 @@
      */
     public static SequenceManager createManager(PersistenceBroker broker, SequenceDescriptor
descriptor)
     {
+        // Default sequence manager (if no explicit SequenceDescriptor / <sequence-manager/>)
+        // is SequenceManagerHighLowImpl, according to:
+        // http://db.apache.org/ojb/docu/guides/sequencemanager.html#How+to+change+the+sequence+manager%3F
+        // (mkalen: NB! The deprecated SequenceManagerFactory used SequenceManagerInMemoryImpl
as default)
+        Class sequenceManagerClass = SequenceManagerHighLowImpl.class;
+        if(descriptor != null) {
+            sequenceManagerClass = descriptor.getSequenceManagerClass();
+        }
         try
         {
             return (SequenceManager) ClassHelper.newInstance(
-                    descriptor.getSequenceManagerClass(),
+                    sequenceManagerClass,
                     new Class[]{PersistenceBroker.class, SequenceDescriptor.class},
                     new Object[]{broker, descriptor});
         }
@@ -530,7 +538,7 @@
             try
             {
                 return (SequenceManager) ClassHelper.newInstance(
-                        descriptor.getSequenceManagerClass(),
+                        sequenceManagerClass,
                         new Class[]{PersistenceBroker.class},
                         new Object[]{broker});
             }



---------------------------------------------------------------------
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