You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by dr...@apache.org on 2010/07/24 13:49:38 UTC

svn commit: r978854 - /tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java

Author: drobiazko
Date: Sat Jul 24 11:49:38 2010
New Revision: 978854

URL: http://svn.apache.org/viewvc?rev=978854&view=rev
Log:
TAP5-1156: Provide a ValueEncoder for a Hibernate entity automatically only if a mapped class exists

Modified:
    tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java

Modified: tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java?rev=978854&r1=978853&r2=978854&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java Sat Jul 24 11:49:38 2010
@@ -94,17 +94,21 @@ public class HibernateModule
         {
             final PersistentClass persistentClass = mappings.next();
             final Class entityClass = persistentClass.getMappedClass();
-
-            ValueEncoderFactory factory = new ValueEncoderFactory()
+            
+            if(entityClass != null)
             {
-                public ValueEncoder create(Class type)
+                ValueEncoderFactory factory = new ValueEncoderFactory()
                 {
-                    return new HibernateEntityValueEncoder(entityClass, persistentClass, session, propertyAccess,
-                                                           typeCoercer, loggerSource.getLogger(entityClass));
-                }
-            };
-
-            configuration.add(entityClass, factory);
+                    public ValueEncoder create(Class type)
+                    {
+                        return new HibernateEntityValueEncoder(entityClass, persistentClass, session, propertyAccess,
+                                                               typeCoercer, loggerSource.getLogger(entityClass));
+                    }
+                };
+    
+                configuration.add(entityClass, factory);
+            
+            }
         }
     }