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