[hibernate-commits] Hibernate SVN: r10462 - trunk/HibernateExt/ejb/src/java/org/hibernate/ejb

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Sep 6 12:27:04 EDT 2006


Author: epbernard
Date: 2006-09-06 12:27:04 -0400 (Wed, 06 Sep 2006)
New Revision: 10462

Modified:
   trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
Log:
move EntityNotFoundDelegate annonymous inner class into private class to make it Serializable

Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java	2006-09-06 16:19:12 UTC (rev 10461)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java	2006-09-06 16:27:04 UTC (rev 10462)
@@ -100,7 +100,14 @@
 	private static final String IMPLEMENTATION_NAME = HibernatePersistence.class.getName();
 	private static final String META_INF_ORM_XML = "META-INF/orm.xml";
 	private static Log log = LogFactory.getLog( Ejb3Configuration.class );
+	private static EntityNotFoundDelegate ejb3EntityNotFoundDelegate = new Ejb3EntityNotFoundDelegate();
 
+	private static class Ejb3EntityNotFoundDelegate implements EntityNotFoundDelegate, Serializable {
+		public void handleEntityNotFound(String entityName, Serializable id) {
+			throw new EntityNotFoundException("Unable to find " + entityName  + " with id " + id);
+		}
+	}
+
 	static {
 		Version.touch();
 	}
@@ -116,12 +123,7 @@
 	public Ejb3Configuration() {
 		settingsFactory = new InjectionSettingsFactory();
 		cfg = new AnnotationConfiguration( settingsFactory );
-		cfg.setEntityNotFoundDelegate( new EntityNotFoundDelegate() {
-
-			public void handleEntityNotFound(String entityName, Serializable id) {
-				throw new EntityNotFoundException("Unable to find " + entityName  + " with id " + id);
-			}
-		} );
+		cfg.setEntityNotFoundDelegate( ejb3EntityNotFoundDelegate );
 		listenerConfigurator = new EventListenerConfigurator( this );
 	}
 




More information about the hibernate-commits mailing list