HHH-6159 - Create EntityManagerFactoryBuilder : remove explicit 'use metamodel' flag + fixed query imports from hbm processing

This commit is contained in:
Steve Ebersole 2012-07-25 15:24:23 -05:00
parent 61fe3b7457
commit e3a606e3db
2 changed files with 19 additions and 10 deletions

View File

@ -264,9 +264,25 @@ public class HibernateMappingProcessor {
private void processEntityElementImport(EntityElement entityElement) {
final String qualifiedName = bindingContext().determineEntityName( entityElement );
metadata.addImport( entityElement.getEntityName() == null
? entityElement.getName()
: entityElement.getEntityName(), qualifiedName );
final String importName = entityElement.getEntityName() == null
? entityElement.getName()
: entityElement.getEntityName();
metadata.addImport( importName, qualifiedName );
if ( JaxbClassElement.class.isInstance( entityElement ) ) {
processEntityElementsImport( ( (JaxbClassElement) entityElement ).getSubclass() );
processEntityElementsImport( ( (JaxbClassElement) entityElement ).getJoinedSubclass() );
processEntityElementsImport( ( (JaxbClassElement) entityElement ).getUnionSubclass() );
}
else if ( JaxbSubclassElement.class.isInstance( entityElement ) ) {
processEntityElementsImport( ( (JaxbSubclassElement) entityElement ).getSubclass() );
}
else if ( JaxbJoinedSubclassElement.class.isInstance( entityElement ) ) {
processEntityElementsImport( ( (JaxbJoinedSubclassElement) entityElement ).getJoinedSubclass() );
}
else if ( JaxbUnionSubclassElement.class.isInstance( entityElement ) ) {
processEntityElementsImport( ( (JaxbUnionSubclassElement) entityElement ).getUnionSubclass() );
}
}
private void processResultSetMappings() {

View File

@ -30,7 +30,6 @@ import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
@ -53,12 +52,6 @@ public class DiscriminatorTest extends BaseCoreFunctionalTestCase {
return new String[] { "discriminator/Person.hbm.xml" };
}
@Override
protected void configure(Configuration configuration) {
super.configure( configuration );
configuration.setProperty( USE_NEW_METADATA_MAPPINGS, "true" );
}
@Test
public void testDiscriminatorSubclass() {
Session s = openSession();