[seam-commits] Seam SVN: r8528 - trunk/src/main/org/jboss/seam/persistence and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 28 11:56:05 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-07-28 11:56:05 -0400 (Mon, 28 Jul 2008)
New Revision: 8528

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

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-07-28 15:44:59 UTC (rev 8527)
+++ branches/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2008-07-28 15:56:05 UTC (rev 8528)
@@ -16,6 +16,7 @@
 import org.hibernate.StaleStateException;
 import org.hibernate.TransientObjectException;
 import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.proxy.HibernateProxy;
 import org.hibernate.type.VersionType;
 import org.jboss.seam.Component;
 import org.jboss.seam.Entity;
@@ -166,7 +167,14 @@
        }
        catch (TransientObjectException e) 
        {
-          return super.getId(bean, entityManager);
+          if (bean instanceof HibernateProxy)
+          {
+             return super.getId(((HibernateProxy) bean).getHibernateLazyInitializer().getImplementation(), entityManager);
+          }
+          else
+          {
+             return super.getId(bean, entityManager);
+          }
        }
    }
    

Modified: trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2008-07-28 15:44:59 UTC (rev 8527)
+++ trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2008-07-28 15:56:05 UTC (rev 8528)
@@ -16,6 +16,7 @@
 import org.hibernate.StaleStateException;
 import org.hibernate.TransientObjectException;
 import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.proxy.HibernateProxy;
 import org.hibernate.type.VersionType;
 import org.jboss.seam.Component;
 import org.jboss.seam.Entity;
@@ -166,7 +167,14 @@
        }
        catch (TransientObjectException e) 
        {
-          return super.getId(bean, entityManager);
+          if (bean instanceof HibernateProxy)
+          {
+             return super.getId(((HibernateProxy) bean).getHibernateLazyInitializer().getImplementation(), entityManager);
+          }
+          else
+          {
+             return super.getId(bean, entityManager);
+          }
        }
    }
    




More information about the seam-commits mailing list