You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2005/10/30 01:31:39 UTC

svn commit: r329493 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java

Author: tomdz
Date: Sat Oct 29 16:31:32 2005
New Revision: 329493

URL: http://svn.apache.org/viewcvs?rev=329493&view=rev
Log:
Fix for DDLUTILS-37

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java?rev=329493&r1=329492&r2=329493&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java Sat Oct 29 16:31:32 2005
@@ -52,7 +52,7 @@
     /** The tables. */
     private ArrayList _tables = new ArrayList();
     /** The dyna class cache for this model. */
-    private DynaClassCache _dynaClassCache = new DynaClassCache();
+    private transient DynaClassCache _dynaClassCache = null;
 
     /**
      * Adds all tables from the other database to this database.
@@ -428,6 +428,20 @@
     }
 
     /**
+     * Returns the dyna class cache. If none is available yet, a new one will be created.
+     * 
+     * @return The dyna class cache
+     */
+    private DynaClassCache getDynaClassCache()
+    {
+        if (_dynaClassCache == null)
+        {
+            _dynaClassCache = new DynaClassCache();
+        }
+        return _dynaClassCache;
+    }
+
+    /**
      * Returns the {@link org.apache.ddlutils.dynabean.SqlDynaClass} for the given table name. If the it does not
      * exist yet, a new one will be created based on the Table definition.
      * 
@@ -439,7 +453,7 @@
     {
         Table table = findTable(tableName);
 
-        return table != null ? _dynaClassCache.getDynaClass(table) : null;
+        return table != null ? getDynaClassCache().getDynaClass(table) : null;
     }
 
     /**
@@ -450,7 +464,7 @@
      */
     public SqlDynaClass getDynaClassFor(DynaBean bean)
     {
-        return _dynaClassCache.getDynaClass(bean);
+        return getDynaClassCache().getDynaClass(bean);
     }
 
     /**
@@ -461,7 +475,7 @@
      */
     public DynaBean createDynaBeanFor(Table table) throws DynaSqlException
     {
-        return _dynaClassCache.createNewInstance(table);
+        return getDynaClassCache().createNewInstance(table);
     }
 
     /**
@@ -474,7 +488,7 @@
      */
     public DynaBean createDynaBeanFor(String tableName, boolean caseSensitive) throws DynaSqlException
     {
-        return _dynaClassCache.createNewInstance(findTable(tableName, caseSensitive));
+        return getDynaClassCache().createNewInstance(findTable(tableName, caseSensitive));
     }
 
     /**