HHH-8118 cleanup, deprecation, comments, corrected test failures

This commit is contained in:
Brett Meyer 2013-08-16 15:29:39 -04:00
parent 0f453745dc
commit 7901118f0a
17 changed files with 135 additions and 152 deletions

View File

@ -31,6 +31,7 @@ import java.util.Map;
import org.hibernate.PropertyNotFoundException;
import org.hibernate.QueryException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.hql.internal.ast.DetailedSemanticException;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.StringHelper;
@ -176,11 +177,11 @@ public class ConstructorNode extends SelectExpressionList implements AggregatedS
throw new SemanticException( "Unable to locate class [" + path + "]" );
}
try {
Class holderClass = ReflectHelper.classForName( className,
getSessionFactoryHelper().getFactory().getServiceRegistry().getService( ClassLoaderService.class ) );
Class holderClass = getSessionFactoryHelper().getFactory().getServiceRegistry()
.getService( ClassLoaderService.class ).classForName( className );
return ReflectHelper.getConstructor( holderClass, constructorArgumentTypes );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new DetailedSemanticException( "Unable to locate class [" + className + "]", e );
}
catch ( PropertyNotFoundException e ) {

View File

@ -30,11 +30,11 @@ import java.util.UUID;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.uuid.StandardRandomStrategy;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.UUIDTypeDescriptor;
import org.jboss.logging.Logger;
@ -80,7 +80,7 @@ public class UUIDGenerator implements IdentifierGenerator, Configurable {
final String strategyClassName = params.getProperty( UUID_GEN_STRATEGY_CLASS );
if ( strategyClassName != null ) {
try {
final Class strategyClass = ReflectHelper.classForName( strategyClassName, classLoaderService );
final Class strategyClass = classLoaderService.classForName( strategyClassName );
try {
strategy = (UUIDGenerationStrategy) strategyClass.newInstance();
}
@ -88,7 +88,7 @@ public class UUIDGenerator implements IdentifierGenerator, Configurable {
LOG.unableToInstantiateUuidGenerationStrategy(ignore);
}
}
catch ( ClassNotFoundException ignore ) {
catch ( ClassLoadingException ignore ) {
LOG.unableToLocateUuidGenerationStrategy(strategyClassName);
}
}

View File

@ -27,7 +27,6 @@ import java.lang.reflect.Constructor;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.ReflectHelper;
import org.jboss.logging.Logger;
/**
@ -68,7 +67,8 @@ public class OptimizerFactory {
* @deprecated Use {@link #buildOptimizer(String, Class, int, long)} instead
*/
@Deprecated
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize, ClassLoaderService classLoaderService) {
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize,
ClassLoaderService classLoaderService) {
final Class<? extends Optimizer> optimizerClass;
final StandardOptimizerDescriptor standardDescriptor = StandardOptimizerDescriptor.fromExternalName( type );
@ -77,7 +77,7 @@ public class OptimizerFactory {
}
else {
try {
optimizerClass = ReflectHelper.classForName( type, classLoaderService );
optimizerClass = classLoaderService.classForName( type );
}
catch( Throwable ignore ) {
LOG.unableToLocateCustomOptimizerClass( type );

View File

@ -50,7 +50,6 @@ import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.id.enhanced.TableGenerator;
import org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.service.spi.ServiceRegistryAwareService;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.type.Type;
@ -135,16 +134,13 @@ public class DefaultIdentifierGeneratorFactory implements MutableIdentifierGener
Class generatorClass = generatorStrategyToClassNameMap.get( strategy );
try {
if ( generatorClass == null ) {
generatorClass = ReflectHelper.classForName( strategy, classLoaderService );
generatorClass = classLoaderService.classForName( strategy );
register( strategy, generatorClass );
}
}
catch ( ClassLoadingException e ) {
throw new MappingException( String.format( "Could not interpret id generator strategy [%s]", strategy ) );
}
catch ( ClassNotFoundException e ) {
throw new MappingException( String.format( "Could not interpret id generator strategy [%s]", strategy ) );
}
return generatorClass;
}

View File

@ -20,15 +20,18 @@
*/
package org.hibernate.internal.util;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
/**
* This exists purely to allow custom ClassLoaders to be injected and used
* prior to ServiceRegistry and ClassLoadingService existence. This should be
* replaced in Hibernate 5.
*
* TODO: Delete after HHH-6184.
* @deprecated Replace with direct use of {@link ClassLoaderService}.
*
* @author Brett Meyer
*/
@Deprecated
public class ClassLoaderHelper {
public static ClassLoader overridenClassLoader = null;

View File

@ -130,6 +130,11 @@ public final class ConfigHelper {
private ConfigHelper() {}
/**
* TODO: Kept only for legacy ORM 4 callers. Remove in ORM 5.
* @deprecated Replace with direct use of {@link ClassLoaderService}.
*/
@Deprecated
public static InputStream getResourceAsStream(String resource) {
String stripped = resource.startsWith("/") ?
resource.substring(1) : resource;
@ -151,7 +156,11 @@ public final class ConfigHelper {
return stream;
}
/**
* TODO: Kept only for legacy ORM 4 callers. Remove in ORM 5.
* @deprecated Replace with direct use of {@link ClassLoaderService}.
*/
@Deprecated
public static InputStream getUserResourceAsStream(String resource) {
boolean hasLeadingSlash = resource.startsWith( "/" );
String stripped = hasLeadingSlash ? resource.substring(1) : resource;

View File

@ -168,22 +168,13 @@ public final class ReflectHelper {
}
/**
* Perform resolution of a class name.
* <p/>
* Here we first check the context classloader, if one, before delegating to
* {@link Class#forName(String, boolean, ClassLoader)} using the caller's classloader
*
* @param name The class name
* @param caller The class from which this call originated (in order to access that class's loader).
* @param classLoaderService ClassLoaderService
* @return The class reference.
* @throws ClassNotFoundException From {@link Class#forName(String, boolean, ClassLoader)}.
*/
public static Class classForName(String name, Class caller, ClassLoaderService classLoaderService) throws ClassNotFoundException {
* TODO: Kept only for legacy ORM 4 callers. Remove in ORM 5.
* @deprecated Replace with direct use of {@link ClassLoaderService}.
*/
@Deprecated
public static Class classForName(String name, Class caller) throws ClassNotFoundException {
try {
if ( classLoaderService != null ) {
return classLoaderService.classForName(name);
}
return new ClassLoaderServiceImpl().classForName(name);
}
catch ( Throwable ignore ) {
}
@ -196,43 +187,19 @@ public final class ReflectHelper {
}
/**
* Perform resolution of a class name.
* <p/>
* Same as {@link #classForName(String, Class)} except that here we delegate to
* {@link Class#forName(String)} if the context classloader lookup is unsuccessful.
*
* @param name The class name
* @param classLoaderService ClassLoaderService
* @return The class reference.
* @throws ClassNotFoundException From {@link Class#forName(String)}.
*/
public static Class classForName(String name, ClassLoaderService classLoaderService) throws ClassNotFoundException {
* TODO: Kept only for legacy ORM 4 callers. Remove in ORM 5.
* @deprecated Replace with direct use of {@link ClassLoaderService}.
*/
@Deprecated
public static Class classForName(String name) throws ClassNotFoundException {
try {
if ( classLoaderService != null ) {
return classLoaderService.classForName(name);
}
return new ClassLoaderServiceImpl().classForName(name);
}
catch ( Throwable ignore ) {
}
return Class.forName( name );
}
/**
* TODO: Kept only for org.hibernate.cfg. Remove in 5.0.
*/
@Deprecated
public static Class classForName(String name, Class caller) throws ClassNotFoundException {
return classForName( name, caller, new ClassLoaderServiceImpl() );
}
/**
* TODO: Kept only for org.hibernate.cfg. Remove in 5.0.
*/
@Deprecated
public static Class classForName(String name) throws ClassNotFoundException {
return classForName( name, new ClassLoaderServiceImpl() );
}
/**
* Is this member publicly accessible.
* <p/>
@ -257,17 +224,13 @@ public final class ReflectHelper {
}
/**
* Attempt to resolve the specified property type through reflection.
*
* @param className The name of the class owning the property.
* @param name The name of the property.
* @param classLoaderService ClassLoaderService
* @return The type of the property.
* @throws MappingException Indicates we were unable to locate the property.
*/
public static Class reflectedPropertyClass(String className, String name, ClassLoaderService classLoaderService) throws MappingException {
* TODO: Kept only for legacy ORM 4 callers. Remove in ORM 5.
* @deprecated Replace with direct use of {@link ClassLoaderService}.
*/
@Deprecated
public static Class reflectedPropertyClass(String className, String name) throws MappingException {
try {
Class clazz = classForName( className, classLoaderService );
Class clazz = classForName( className );
return getter( clazz, name ).getReturnType();
}
catch ( ClassNotFoundException cnfe ) {
@ -275,14 +238,6 @@ public final class ReflectHelper {
}
}
/**
* TODO: Kept only for org.hibernate.cfg. Remove in 5.0.
*/
@Deprecated
public static Class reflectedPropertyClass(String className, String name) throws MappingException {
return reflectedPropertyClass( className, name, new ClassLoaderServiceImpl() );
}
/**
* Attempt to resolve the specified property type through reflection.
*
@ -330,7 +285,7 @@ public final class ReflectHelper {
public static Object getConstantValue(String name, ClassLoaderService classLoaderService) {
Class clazz;
try {
clazz = classForName( StringHelper.qualifier( name ), classLoaderService );
clazz = classLoaderService.classForName( StringHelper.qualifier( name ) );
}
catch ( Throwable t ) {
return null;

View File

@ -691,4 +691,12 @@ public class SchemaExport {
return exceptions;
}
public String[] getCreateSqlScripts() {
return createSQL;
}
public String[] getDropSqlScripts() {
return dropSQL;
}
}

View File

@ -29,6 +29,7 @@ import org.junit.Test;
import org.hibernate.MappingException;
import org.hibernate.dialect.Dialect;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static org.junit.Assert.assertEquals;
@ -113,6 +114,7 @@ public class ColumnAliasTest extends BaseUnitTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testNameStartsWithNonCharacterTruncation() {
Column column = table0.createColumn( "1" );
String expectedSuffix = getExpectedSuffix( column, null );
@ -136,6 +138,7 @@ public class ColumnAliasTest extends BaseUnitTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testNameIncludingNonCharacter() {
// create dialect with a large enough max alias length so there is no trucation.
final Dialect dialect = createDialect( 10 );

View File

@ -23,23 +23,25 @@
*/
package org.hibernate.test.annotations.id;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.internal.MetadataImpl;
import org.hibernate.metamodel.spi.MetadataImplementor;
import org.hibernate.test.annotations.id.entities.Bunny;
import org.hibernate.test.annotations.id.entities.PointyTooth;
import org.hibernate.test.annotations.id.entities.TwinkleToes;
import org.hibernate.testing.ServiceRegistryBuilder;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.jboss.logging.Logger;
import org.junit.Test;
/**
* Tests for JIRA issue ANN-748.
@ -47,36 +49,36 @@ import static org.junit.Assert.fail;
* @author Hardy Ferentschik
*/
@SuppressWarnings("unchecked")
@FailureExpectedWithNewMetamodel
public class JoinColumnOverrideTest extends BaseUnitTestCase {
private static final Logger log = Logger.getLogger( JoinColumnOverrideTest.class );
@Test
@TestForIssue( jiraKey = "ANN-748" )
public void testBlownPrecision() throws Exception {
try {
Configuration config = new Configuration();
config.addAnnotatedClass(Bunny.class);
config.addAnnotatedClass(PointyTooth.class);
config.addAnnotatedClass(TwinkleToes.class);
config.buildMappings( );
String[] schema = config
.generateSchemaCreationScript(new SQLServerDialect());
for (String s : schema) {
log.debug(s);
}
String expectedSqlPointyTooth = "create table PointyTooth (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlPointyTooth, schema[1]);
// Configuration config = new Configuration();
// config.addAnnotatedClass(Bunny.class);
// config.addAnnotatedClass(PointyTooth.class);
// config.addAnnotatedClass(TwinkleToes.class);
// config.buildMappings( );
// String[] schema = config
// .generateSchemaCreationScript(new SQLServerDialect());
MetadataSources metadataSources = new MetadataSources( new BootstrapServiceRegistryImpl() );
metadataSources.addAnnotatedClass(Bunny.class);
metadataSources.addAnnotatedClass(PointyTooth.class);
metadataSources.addAnnotatedClass(TwinkleToes.class);
MetadataImplementor metadata = (MetadataImplementor) metadataSources.buildMetadata();
SchemaExport exporter = new SchemaExport( metadata );
String[] schema = exporter.getCreateSqlScripts();
for (String s : schema) {
log.debug(s);
}
String expectedSqlPointyTooth = "create table PointyTooth (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlPointyTooth, schema[1]);
String expectedSqlTwinkleToes = "create table TwinkleToes (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlTwinkleToes, schema[2]);
}
catch (Exception e) {
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
log.debug(writer.toString());
fail(e.getMessage());
}
String expectedSqlTwinkleToes = "create table TwinkleToes (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlTwinkleToes, schema[2]);
}
}

View File

@ -1,23 +1,20 @@
//$Id$
package org.hibernate.test.annotations.id.sequences;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.junit.Assert.assertEquals;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.spi.MetadataImplementor;
import org.hibernate.test.annotations.id.sequences.entities.Bunny;
import org.hibernate.test.annotations.id.sequences.entities.PointyTooth;
import org.hibernate.test.annotations.id.sequences.entities.TwinkleToes;
import org.hibernate.testing.ServiceRegistryBuilder;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.jboss.logging.Logger;
import org.junit.Test;
/**
* Tests for JIRA issue ANN-748.
@ -25,35 +22,35 @@ import static org.junit.Assert.fail;
* @author Hardy Ferentschik
*/
@SuppressWarnings("unchecked")
@FailureExpectedWithNewMetamodel
public class JoinColumnOverrideTest extends BaseUnitTestCase {
private static final Logger log = Logger.getLogger( JoinColumnOverrideTest.class );
@Test
@TestForIssue( jiraKey = "ANN-748" )
public void testBlownPrecision() throws Exception {
try {
Configuration config = new Configuration();
config.addAnnotatedClass(Bunny.class);
config.addAnnotatedClass(PointyTooth.class);
config.addAnnotatedClass(TwinkleToes.class);
config.buildMappings( );
String[] schema = config.generateSchemaCreationScript( new SQLServerDialect() );
for (String s : schema) {
log.debug(s);
}
String expectedSqlPointyTooth = "create table PointyTooth (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlPointyTooth, schema[1]);
// Configuration config = new Configuration();
// config.addAnnotatedClass(Bunny.class);
// config.addAnnotatedClass(PointyTooth.class);
// config.addAnnotatedClass(TwinkleToes.class);
// config.buildMappings( );
// String[] schema = config.generateSchemaCreationScript( new SQLServerDialect() );
MetadataSources metadataSources = new MetadataSources( new BootstrapServiceRegistryImpl() );
metadataSources.addAnnotatedClass(Bunny.class);
metadataSources.addAnnotatedClass(PointyTooth.class);
metadataSources.addAnnotatedClass(TwinkleToes.class);
MetadataImplementor metadata = (MetadataImplementor) metadataSources.buildMetadata();
SchemaExport exporter = new SchemaExport( metadata );
String[] schema = exporter.getCreateSqlScripts();
for (String s : schema) {
log.debug(s);
}
String expectedSqlPointyTooth = "create table PointyTooth (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlPointyTooth, schema[1]);
String expectedSqlTwinkleToes = "create table TwinkleToes (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlTwinkleToes, schema[2]);
}
catch (Exception e) {
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
log.debug(writer.toString());
fail(e.getMessage());
}
String expectedSqlTwinkleToes = "create table TwinkleToes (id numeric(128,0) not null, " +
"bunny_id numeric(128,0), primary key (id))";
assertEquals("Wrong SQL", expectedSqlTwinkleToes, schema[2]);
}
}

View File

@ -29,6 +29,7 @@ import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.TestForIssue;
/**
@ -39,6 +40,7 @@ import org.hibernate.testing.TestForIssue;
* @author Steve Ebersole
*/
@TestForIssue(jiraKey = "HHH-7306")
@FailureExpectedWithNewMetamodel(message = "Needs updated to remove Configuration uses.")
public class CurrentTenantResolverMultiTenancyTest extends SchemaBasedMultiTenancyTest {
private TestCurrentTenantIdentifierResolver currentTenantResolver = new TestCurrentTenantIdentifierResolver();

View File

@ -44,6 +44,7 @@ import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.mapping.RootClass;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.cache.CachingRegionFactory;
import org.hibernate.testing.env.ConnectionProviderBuilder;
import org.hibernate.testing.junit4.BaseUnitTestCase;
@ -53,6 +54,7 @@ import org.hibernate.tool.hbm2ddl.SchemaExport;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewMetamodel(message = "Needs updated to remove Configuration uses.")
public class SchemaBasedMultiTenancyTest extends BaseUnitTestCase {
private DriverManagerConnectionProviderImpl acmeProvider;
private DriverManagerConnectionProviderImpl jbossProvider;

View File

@ -30,6 +30,7 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.ServiceRegistryBuilder;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
@ -44,6 +45,7 @@ import org.junit.Test;
* @author Max Rydahl Andersen
* @author Brett Meyer
*/
@FailureExpectedWithNewMetamodel(message = "Needs updated to remove Configuration uses.")
public class MigrationTest extends BaseUnitTestCase {
private ServiceRegistry serviceRegistry;

View File

@ -24,11 +24,13 @@
package org.hibernate.test.schemaupdate;
import org.hibernate.cfg.Configuration;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.tool.hbm2ddl.SchemaExport;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewMetamodel(message = "Needs updated to remove Configuration uses.")
public class SchemaExportManagedConnectionTest extends SchemaExportTest {
@Override
protected SchemaExport createSchemaExport(Configuration cfg) {

View File

@ -24,11 +24,13 @@
package org.hibernate.test.schemaupdate;
import org.hibernate.cfg.Configuration;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.tool.hbm2ddl.SchemaExport;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewMetamodel(message = "Needs updated to remove Configuration uses.")
public class SchemaExportSuppliedConnectionTest extends SchemaExportTest {
@Override

View File

@ -39,12 +39,12 @@ import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.HibernateEntityManagerFactory;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventType;
import org.hibernate.internal.util.ConfigHelper;
import org.hibernate.jpa.test.Distributor;
import org.hibernate.jpa.test.Item;
import org.hibernate.jpa.test.pack.cfgxmlpar.Morito;
@ -306,8 +306,7 @@ public class PackagedEntityManagerTest extends PackagingTestCase {
HashMap properties = new HashMap();
properties.put( AvailableSettings.JTA_DATASOURCE, null );
Properties p = new Properties();
p.load( serviceRegistry().getService( ClassLoaderService.class ).locateResourceStream(
"/overridenpar.properties" ) );
p.load( ConfigHelper.getResourceAsStream( "/overridenpar.properties" ) );
properties.putAll( p );
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "overridenpar", properties );
EntityManager em = emf.createEntityManager();