HHH-13011 : Restore ParentChildTest assumptions appropriate for hibernate.use_entity_where_clause_for_collections=false (the default in 5.1)
This commit is contained in:
parent
47528f6672
commit
d6f72a7d11
|
@ -478,16 +478,12 @@ public class ParentChildTest extends LegacyTestCase {
|
|||
assertTrue( s.createCriteria(Part.class).list().size()==1 ); //there is a where condition on Part mapping
|
||||
assertTrue( s.createCriteria(Part.class).add( Restrictions.eq( "id", p1.getId() ) ).list().size()==1 );
|
||||
assertTrue( s.createQuery("from Part").list().size()==1 );
|
||||
// only Part entities that satisfy the where condition on Part mapping should be included in the collection
|
||||
assertTrue( s.createQuery("from Baz baz join baz.parts").list().size()==1 );
|
||||
assertTrue( s.createQuery("from Baz baz join baz.parts").list().size()==2 );
|
||||
baz = (Baz) s.createCriteria(Baz.class).uniqueResult();
|
||||
// only Part entities that satisfy the where condition on Part mapping should be included in the collection
|
||||
assertTrue( s.createFilter( baz.getParts(), "" ).list().size()==1 );
|
||||
assertTrue( s.createFilter( baz.getParts(), "" ).list().size()==2 );
|
||||
//assertTrue( baz.getParts().size()==1 );
|
||||
s.delete( s.get( Part.class, p1.getId() ) );
|
||||
// p2.description does not satisfy the condition on Part mapping, so it's not possible to retrieve it
|
||||
// using Session#get; instead just delete using a native query
|
||||
s.createSQLQuery( "delete from Part where id = :id" ).setParameter( "id", p2.getId() ).executeUpdate();
|
||||
s.delete( s.get( Part.class, p1.getId() ));
|
||||
s.delete( s.get( Part.class, p2.getId() ));
|
||||
s.delete(baz);
|
||||
t.commit();
|
||||
s.close();
|
||||
|
@ -514,20 +510,12 @@ public class ParentChildTest extends LegacyTestCase {
|
|||
assertTrue( s.createCriteria(Part.class).list().size()==1 ); //there is a where condition on Part mapping
|
||||
assertTrue( s.createCriteria(Part.class).add( Restrictions.eq( "id", p1.getId() ) ).list().size()==1 );
|
||||
assertTrue( s.createQuery("from Part").list().size()==1 );
|
||||
// only Part entities that satisfy the where condition on Part mapping should be included in the collection
|
||||
assertTrue( s.createQuery("from Baz baz join baz.moreParts").list().size()==1 );
|
||||
assertTrue( s.createQuery("from Baz baz join baz.moreParts").list().size()==2 );
|
||||
baz = (Baz) s.createCriteria(Baz.class).uniqueResult();
|
||||
// only Part entities that satisfy the where condition on Part mapping should be included in the collection
|
||||
assertTrue( s.createFilter( baz.getMoreParts(), "" ).list().size()==1 );
|
||||
assertTrue( s.createFilter( baz.getMoreParts(), "" ).list().size()==2 );
|
||||
//assertTrue( baz.getParts().size()==1 );
|
||||
s.delete( s.get( Part.class, p1.getId() ));
|
||||
// p2.description does not satisfy the condition on Part mapping, so it's not possible to retrieve it
|
||||
// using Session#get; instead just delete using a native query
|
||||
s.createSQLQuery( "delete from baz_moreParts where baz = :baz AND part = :part" )
|
||||
.setParameter( "baz", baz.getCode() )
|
||||
.setParameter( "part", p2.getId() )
|
||||
.executeUpdate();
|
||||
s.createSQLQuery( "delete from Part where id = :id" ).setParameter( "id", p2.getId() ).executeUpdate();
|
||||
s.delete( s.get( Part.class, p2.getId() ));
|
||||
s.delete(baz);
|
||||
t.commit();
|
||||
s.close();
|
||||
|
|
Loading…
Reference in New Issue