cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From and...@apache.org
Subject svn commit: r765245 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
Date Wed, 15 Apr 2009 15:35:25 GMT
Author: andrey
Date: Wed Apr 15 15:35:25 2009
New Revision: 765245

URL: http://svn.apache.org/viewvc?rev=765245&view=rev
Log:
CAY-979 ROP client serialization mechanism dependencies
Fixing default java deserialization for EntityResolver

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java?rev=765245&r1=765244&r2=765245&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
Wed Apr 15 15:35:25 2009
@@ -19,6 +19,8 @@
 
 package org.apache.cayenne.map;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -85,6 +87,13 @@
      * Creates new EntityResolver.
      */
     public EntityResolver() {
+        init();
+    }
+    
+    /**
+     * Initialization of EntityResolver. Used in constructor and in Java deserialization
process
+     */
+    private void init() {
         this.indexedByClass = true;
         this.maps = new ArrayList<DataMap>(3);
         this.embeddableCache = new HashMap<String, Embeddable>();
@@ -647,6 +656,7 @@
      * @return the required DbEntity, or null if none matches the specifier
      * @deprecated since 3.0 - lookup DbEntity via ObjEntity instead.
      */
+    @Deprecated
     public synchronized DbEntity lookupDbEntity(Class<?> aClass) {
         ObjEntity oe = lookupObjEntity(aClass);
         return oe != null ? oe.getDbEntity() : null;
@@ -659,6 +669,7 @@
      * @return the required DbEntity, or null if none matches the specifier
      * @deprecated since 3.0 - lookup DbEntity via ObjEntity instead.
      */
+    @Deprecated
     public synchronized DbEntity lookupDbEntity(Persistent dataObject) {
         return lookupDbEntity(dataObject.getClass());
     }
@@ -731,6 +742,7 @@
      * @return the required ObjEntity or null if there is none that matches the specifier
      * @deprecated since 3.0 - use getObjEntity() instead.
      */
+    @Deprecated
     public synchronized ObjEntity lookupObjEntity(String entityName) {
         return _lookupObjEntity(entityName);
     }
@@ -897,4 +909,13 @@
     public void setEntityListenerFactory(EntityListenerFactory entityListenerFactory) {
         this.entityListenerFactory = entityListenerFactory;
     }
+
+    /**
+     * Java default deserialization seems not to invoke constructor by default - 
+     * invoking it manually
+     */
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
+        init();
+        in.defaultReadObject();
+    }
 }



Mime
View raw message