[seam-commits] Seam SVN: r8311 - in branches/Seam_2_0/src/main/org/jboss/seam: persistence and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri May 30 09:25:37 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-05-30 09:25:37 -0400 (Fri, 30 May 2008)
New Revision: 8311

Modified:
   branches/Seam_2_0/src/main/org/jboss/seam/Entity.java
   branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
Log:
JBSEAM-3049

Modified: branches/Seam_2_0/src/main/org/jboss/seam/Entity.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/Entity.java	2008-05-30 00:11:57 UTC (rev 8310)
+++ branches/Seam_2_0/src/main/org/jboss/seam/Entity.java	2008-05-30 13:25:37 UTC (rev 8311)
@@ -158,11 +158,11 @@
       {
          throw new NotEntityException("Not an entity class: " + clazz.getName());
       }
-      String name = getModelName(clazz);
+      String name = getModelName(entityClass);
       Model model = (Model) Contexts.getApplicationContext().get(name);
       if (model == null || !(model instanceof Entity))
       {
-         Entity entity = new Entity(clazz);
+         Entity entity = new Entity(entityClass);
          Contexts.getApplicationContext().set(name, entity);
          return entity;
       }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2008-05-30 00:11:57 UTC (rev 8310)
+++ branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2008-05-30 13:25:37 UTC (rev 8311)
@@ -20,6 +20,7 @@
 import org.jboss.seam.Component;
 import org.jboss.seam.Entity;
 import org.jboss.seam.ScopeType;
+import org.jboss.seam.Entity.NotEntityException;
 import org.jboss.seam.annotations.Install;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
@@ -318,11 +319,20 @@
    
    public static Class getEntityClass(Object bean)
    {
-      Class clazz = Hibernate.getClass(bean);
-      if (clazz == null)
+      Class clazz = null;
+      try
       {
          clazz = Entity.forBean(bean).getBeanClass();
       }
+      catch (NotEntityException e) {
+         // It's ok, try some other methods
+      }
+      
+      if (clazz == null)
+      {
+         clazz = Hibernate.getClass(bean);
+      }
+      
       return clazz;
    }
    




More information about the seam-commits mailing list