log.trace( "success" );
}
}
public void testXmlOverride() {
AnnotationConfiguration config = new AnnotationConfiguration();
config.addAnnotatedClass( Customer5.class );
config.addAnnotatedClass( Order.class );
config.addAnnotatedClass( Country.class );
InputStream is = Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream( "org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml" );
config.addInputStream( is );
SessionFactoryImplementor sessionImpl = ( SessionFactoryImplementor ) config.buildSessionFactory();
assertTrue(
"fetch profile not parsed properly",
sessionImpl.containsFetchProfileDefinition( "orders-profile" )
);
// now the same with no xml
config = new AnnotationConfiguration();
config.addAnnotatedClass( Customer5.class );
config.addAnnotatedClass( Order.class );
config.addAnnotatedClass( Country.class );
try {
config.buildSessionFactory();
fail();
}
catch ( MappingException e ) {
log.trace( "success" );
}