[hibernate-commits] Hibernate SVN: r18712 - in core/trunk: core/src/main/java/org/hibernate/impl and 1 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Sun Feb 7 14:27:19 EST 2010
Author: steve.ebersole at jboss.com
Date: 2010-02-07 14:27:19 -0500 (Sun, 07 Feb 2010)
New Revision: 18712
Modified:
core/trunk/core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java
Log:
HHH-4664 - Implement EntityManagerFactory#getProperties()
Modified: core/trunk/core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java 2010-02-06 13:59:15 UTC (rev 18711)
+++ core/trunk/core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java 2010-02-07 19:27:19 UTC (rev 18712)
@@ -25,6 +25,7 @@
package org.hibernate.engine;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.sql.Connection;
@@ -63,6 +64,13 @@
public interface SessionFactoryImplementor extends Mapping, SessionFactory {
/**
+ * Get a copy of the Properties used to configure this session factory.
+ *
+ * @return The properties.
+ */
+ public Properties getProperties();
+
+ /**
* Get the persister for the named entity
*
* @param entityName The name of the entity for which to retrieve the persister.
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-02-06 13:59:15 UTC (rev 18711)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-02-07 19:27:19 UTC (rev 18712)
@@ -467,6 +467,10 @@
this.observer.sessionFactoryCreated( this );
}
+ public Properties getProperties() {
+ return properties;
+ }
+
public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
return null;
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java 2010-02-06 13:59:15 UTC (rev 18711)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java 2010-02-07 19:27:19 UTC (rev 18712)
@@ -21,7 +21,10 @@
*/
package org.hibernate.ejb;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.util.Iterator;
import java.io.Serializable;
@@ -61,7 +64,9 @@
private final CriteriaBuilderImpl criteriaBuilder;
private final Metamodel metamodel;
private final HibernatePersistenceUnitUtil util;
+ private final Map<String,Object> properties;
+ @SuppressWarnings( "unchecked" )
public EntityManagerFactoryImpl(
SessionFactory sessionFactory,
PersistenceUnitTransactionType transactionType,
@@ -72,7 +77,6 @@
this.transactionType = transactionType;
this.discardOnClose = discardOnClose;
this.sessionInterceptorClass = sessionInterceptorClass;
- @SuppressWarnings( "unchecked" )
final Iterator<PersistentClass> classes = cfg.getClassMappings();
//a safe guard till we are confident that metamodel is wll tested
if ( !"disabled".equalsIgnoreCase( cfg.getProperty( "hibernate.ejb.metamodel.generation" ) ) ) {
@@ -83,8 +87,21 @@
}
this.criteriaBuilder = new CriteriaBuilderImpl( this );
this.util = new HibernatePersistenceUnitUtil( this );
+
+ HashMap<String,Object> props = new HashMap<String, Object>();
+ addAll( props, ( (SessionFactoryImplementor) sessionFactory ).getProperties() );
+ addAll( props, cfg.getProperties() );
+ this.properties = Collections.unmodifiableMap( props );
}
+ private static void addAll(HashMap<String, Object> propertyMap, Properties properties) {
+ for ( Map.Entry entry : properties.entrySet() ) {
+ if ( String.class.isInstance( entry.getKey() ) ) {
+ propertyMap.put( (String)entry.getKey(), entry.getValue() );
+ }
+ }
+ }
+
public EntityManager createEntityManager() {
return createEntityManager( null );
}
@@ -102,7 +119,7 @@
}
public Metamodel getMetamodel() {
- return metamodel; //To change body of implemented methods use File | Settings | File Templates.
+ return metamodel;
}
public void close() {
@@ -110,8 +127,7 @@
}
public Map<String, Object> getProperties() {
- //FIXME
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return properties;
}
public Cache getCache() {
More information about the hibernate-commits
mailing list