db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core PersistenceBrokerFactoryDefaultImpl.java PersistenceBrokerImpl.java
Date Mon, 31 May 2004 23:23:06 GMT
arminw      2004/05/31 16:23:06

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerFactoryDefaultImpl.java
                        PersistenceBrokerImpl.java
  Log:
  - log warn message when store/delete operation without
  tx-demarcation was done
  - use ToStringBuilder for object trace
  
  Revision  Changes    Path
  1.11      +6 -5      db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerFactoryDefaultImpl.java
  
  Index: PersistenceBrokerFactoryDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerFactoryDefaultImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PersistenceBrokerFactoryDefaultImpl.java	22 May 2004 09:51:25 -0000	1.10
  +++ PersistenceBrokerFactoryDefaultImpl.java	31 May 2004 23:23:06 -0000	1.11
  @@ -15,6 +15,10 @@
    * limitations under the License.
    */
   
  +import java.util.Properties;
  +
  +import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.commons.lang.builder.ToStringStyle;
   import org.apache.commons.pool.KeyedObjectPool;
   import org.apache.commons.pool.KeyedPoolableObjectFactory;
   import org.apache.commons.pool.impl.GenericKeyedObjectPool;
  @@ -25,9 +29,6 @@
   import org.apache.ojb.broker.util.BrokerHelper;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.util.logging.LoggingHelper;
  -
  -import java.util.Properties;
   
   /**
    * This is the default implementation of the {@link PersistenceBrokerFactoryIF}
  @@ -203,7 +204,7 @@
           GenericKeyedObjectPool.Config conf = poolConfig.getKeyedObjectPoolConfig();
           if (log.isDebugEnabled())
               log.debug("PersistenceBroker pool will be setup with the following configuration
" +
  -                    LoggingHelper.traceObject(conf));
  +                    ToStringBuilder.reflectionToString(conf, ToStringStyle.MULTI_LINE_STYLE));
           GenericKeyedObjectPool pool = new GenericKeyedObjectPool(null, conf);
           pool.setFactory(new PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(this,
pool));
           return pool;
  
  
  
  1.81      +12 -2     db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- PersistenceBrokerImpl.java	7 May 2004 22:07:06 -0000	1.80
  +++ PersistenceBrokerImpl.java	31 May 2004 23:23:06 -0000	1.81
  @@ -315,7 +315,7 @@
            */
           if (isInTransaction())
           {
  -            logger.error("Try to close a ");
  +            logger.error("Broker is still in PB-transaction, do automatic abort before
close!");
               abortTransaction();
           }
           if (logger.isDebugEnabled())
  @@ -435,6 +435,11 @@
        */
       public void delete(Object obj) throws PersistenceBrokerException
       {
  +        if(!isInTransaction())
  +        {
  +            logger.warn("No running tx found, please only delete objects in context of
an PB-transaction" +
  +                    ", to avoid side-effects - e.g. when rollback of complex objects");
  +        }
           try
           {
               doDelete(obj);
  @@ -1544,6 +1549,11 @@
        */
       private void store(Object obj, Identity oid, ClassDescriptor cld, boolean insert)
       {
  +        if(!isInTransaction())
  +        {
  +            logger.warn("No running tx found, please only store in context of an PB-transaction"
+
  +                    ", to avoid side-effects - e.g. when rollback of complex objects");
  +        }
           // Invoke events on PersistenceBrokerAware instances and listeners
           if (insert)
           {
  
  
  

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