[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Mon Jun 11 01:30:27 EDT 2007
User: gavin
Date: 07/06/11 01:30:27
Modified: src/main/org/jboss/seam/core ManagedHibernateSession.java
ManagedPersistenceContext.java
Log:
JBSEAM-1160
Revision Changes Path
1.35 +11 -12 jboss-seam/src/main/org/jboss/seam/core/ManagedHibernateSession.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ManagedHibernateSession.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ManagedHibernateSession.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- ManagedHibernateSession.java 29 May 2007 02:56:25 -0000 1.34
+++ ManagedHibernateSession.java 11 Jun 2007 05:30:27 -0000 1.35
@@ -1,4 +1,4 @@
-//$Id: ManagedHibernateSession.java,v 1.34 2007/05/29 02:56:25 gavin Exp $
+//$Id: ManagedHibernateSession.java,v 1.35 2007/06/11 05:30:27 gavin Exp $
package org.jboss.seam.core;
import static org.jboss.seam.InterceptionType.NEVER;
@@ -144,27 +144,26 @@
private SessionFactory getSessionFactoryFromJndiOrValueBinding()
{
- if (sessionFactory==null)
+ SessionFactory result = null;
+ //first try to find it via the value binding
+ if (sessionFactory!=null)
+ {
+ result = sessionFactory.getValue();
+ }
+ //if its not there, try JNDI
+ if (result==null)
{
try
{
- return (SessionFactory) Naming.getInitialContext().lookup(sessionFactoryJndiName);
+ result = (SessionFactory) Naming.getInitialContext().lookup(sessionFactoryJndiName);
}
catch (NamingException ne)
{
throw new IllegalArgumentException("SessionFactory not found in JNDI", ne);
}
}
- else
- {
- SessionFactory result = sessionFactory.getValue();
- if (result==null)
- {
- throw new IllegalStateException("SessionFactory not found");
- }
return result;
}
- }
public String getComponentName() {
return componentName;
1.44 +11 -7 jboss-seam/src/main/org/jboss/seam/core/ManagedPersistenceContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ManagedPersistenceContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ManagedPersistenceContext.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- ManagedPersistenceContext.java 30 May 2007 20:15:59 -0000 1.43
+++ ManagedPersistenceContext.java 11 Jun 2007 05:30:27 -0000 1.44
@@ -1,4 +1,4 @@
-//$Id: ManagedPersistenceContext.java,v 1.43 2007/05/30 20:15:59 gavin Exp $
+//$Id: ManagedPersistenceContext.java,v 1.44 2007/06/11 05:30:27 gavin Exp $
package org.jboss.seam.core;
import static org.jboss.seam.InterceptionType.NEVER;
@@ -156,21 +156,25 @@
public EntityManagerFactory getEntityManagerFactoryFromJndiOrValueBinding()
{
- if (entityManagerFactory==null)
+ EntityManagerFactory result = null;
+ //first try to find it via the value binding
+ if (entityManagerFactory!=null)
+ {
+ result = entityManagerFactory.getValue();
+ }
+ //if its not there, try JNDI
+ if (result==null)
{
try
{
- return (EntityManagerFactory) Naming.getInitialContext().lookup(persistenceUnitJndiName);
+ result = (EntityManagerFactory) Naming.getInitialContext().lookup(persistenceUnitJndiName);
}
catch (NamingException ne)
{
throw new IllegalArgumentException("EntityManagerFactory not found in JNDI", ne);
}
}
- else
- {
- return entityManagerFactory.getValue();
- }
+ return result;
}
/**
More information about the jboss-cvs-commits
mailing list