test code only fix

This commit is contained in:
Strong Liu 2013-01-17 13:54:58 +08:00
parent f651b73f23
commit f2ad705fc0
1 changed files with 7 additions and 8 deletions

View File

@ -36,6 +36,7 @@ import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchStyle;
import org.hibernate.engine.FetchTiming;
import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding;
import org.hibernate.stat.QueryStatistics; import org.hibernate.stat.QueryStatistics;
import org.hibernate.stat.Statistics; import org.hibernate.stat.Statistics;
@ -66,7 +67,7 @@ public class StatsTest extends BaseCoreFunctionalTestCase {
@Test @Test
@SuppressWarnings( {"UnusedAssignment"}) @SuppressWarnings( {"UnusedAssignment"})
@FailureExpectedWithNewMetamodel // @FailureExpectedWithNewMetamodel
public void testCollectionFetchVsLoad() throws Exception { public void testCollectionFetchVsLoad() throws Exception {
Statistics stats = sessionFactory().getStatistics(); Statistics stats = sessionFactory().getStatistics();
stats.clear(); stats.clear();
@ -109,9 +110,8 @@ public class StatsTest extends BaseCoreFunctionalTestCase {
// open second SessionFactory // open second SessionFactory
PluralAttributeBinding coll = SchemaUtil.getCollection( Continent.class, "countries", metadata() ); PluralAttributeBinding coll = SchemaUtil.getCollection( Continent.class, "countries", metadata() );
coll.setFetchStyle( FetchStyle.JOIN ); coll.setFetchStyle( FetchStyle.JOIN );
// TODO: Is there a way to set this on the metamodel? coll.setFetchTiming( FetchTiming.IMMEDIATE );
// coll.setLazy(false); SessionFactory sf = metadata().getSessionFactoryBuilder().build();
SessionFactory sf = sessionFactory();
stats = sf.getStatistics(); stats = sf.getStatistics();
stats.clear(); stats.clear();
stats.setStatisticsEnabled(true); stats.setStatisticsEnabled(true);
@ -132,10 +132,9 @@ public class StatsTest extends BaseCoreFunctionalTestCase {
// open third SessionFactory // open third SessionFactory
coll = SchemaUtil.getCollection( Continent.class, "countries", metadata() ); coll = SchemaUtil.getCollection( Continent.class, "countries", metadata() );
coll.setFetchStyle( FetchStyle.SELECT ); coll.setFetchStyle( FetchStyle.SELECT );
// TODO: Is there a way to set this on the metamodel? coll.setFetchTiming( FetchTiming.IMMEDIATE );
// coll.setLazy(false); sf = metadata().getSessionFactoryBuilder().build();
sf = sessionFactory();
stats = sf.getStatistics(); stats = sf.getStatistics();
stats.clear(); stats.clear();
stats.setStatisticsEnabled(true); stats.setStatisticsEnabled(true);