diff --git a/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java b/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java index 80496df2be..99269d7613 100755 --- a/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java +++ b/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java @@ -65,7 +65,13 @@ public class EntityManagerFactoryImpl implements HibernateEntityManagerFactory { this.sessionInterceptorClass = sessionInterceptorClass; @SuppressWarnings( "unchecked" ) final Iterator classes = cfg.getClassMappings(); - this.metamodel = new MetamodelImpl( classes ); + //a safe guard till we are confident that metamodel is wll tested + if ( !"disabled".equalsIgnoreCase( cfg.getProperty( "hibernate.ejb.metamodel.generation" ) ) ) { + this.metamodel = new MetamodelImpl( classes ); + } + else { + this.metamodel = null; + } this.criteriaQueryBuilder = new QueryBuilderImpl( this ); }