Configuration cfg = new Configuration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
String[] resources = getResources();
for ( int i = 0; i < resources.length; i++ ) {
cfg.addResource( resources[i] );
}
factory = cfg.buildSessionFactory();