[seam-commits] Seam SVN: r13813 - modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Oct 7 16:50:28 EDT 2010


Author: swd847
Date: 2010-10-07 16:50:28 -0400 (Thu, 07 Oct 2010)
New Revision: 13813

Modified:
   modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java
Log:
SEAMPERSIST-8 backport hibernate search fixes from seam 2


Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2010-10-07 15:23:09 UTC (rev 13812)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java	2010-10-07 20:50:28 UTC (rev 13813)
@@ -37,18 +37,17 @@
    {
       try
       {
-         String version = null;
+         boolean hibernateSearchPresent = false;
          try
          {
-            Class<?> searchVersionClass = Reflections.classForName("org.hibernate.search.Version");
-            Method versionMethod = searchVersionClass.getDeclaredMethod("getVersionString");
-            version = (String) versionMethod.invoke(null);
+            Reflections.classForName("org.hibernate.search.Version");
+            hibernateSearchPresent = true;
          }
          catch (Exception e)
          {
             log.debug("no Hibernate Search", e);
          }
-         if (version != null)
+         if (hibernateSearchPresent)
          {
             Class<?> searchClass = Reflections.classForName("org.hibernate.search.Search");
             try
@@ -202,12 +201,16 @@
     */
    static Session proxySession(Session session)
    {
-      if (FULL_TEXT_SESSION_CONSTRUCTOR == null)
+      if (FULL_TEXT_SESSION_CONSTRUCTOR == null || FULL_TEXT_SESSION == null)
       {
          return session;
       }
       else
       {
+         if (FULL_TEXT_SESSION.isAssignableFrom(session.getClass()))
+         {
+            return session;
+         }
          try
          {
             return (Session) FULL_TEXT_SESSION_CONSTRUCTOR.invoke(null, session);



More information about the seam-commits mailing list