mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 22:39:13 +00:00
Fix failing WithClauseTest
This commit is contained in:
parent
4ec71e2621
commit
877a05213c
@ -227,22 +227,27 @@ public void testWithClauseAsSubqueryWithKey() {
|
|||||||
public void testWithClauseAsNonSubqueryWithKey() {
|
public void testWithClauseAsNonSubqueryWithKey() {
|
||||||
rebuildSessionFactory( Collections.singletonMap( AvailableSettings.COLLECTION_JOIN_SUBQUERY, "false" ) );
|
rebuildSessionFactory( Collections.singletonMap( AvailableSettings.COLLECTION_JOIN_SUBQUERY, "false" ) );
|
||||||
|
|
||||||
TestData data = new TestData();
|
try {
|
||||||
data.prepare();
|
TestData data = new TestData();
|
||||||
|
data.prepare();
|
||||||
|
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction txn = s.beginTransaction();
|
Transaction txn = s.beginTransaction();
|
||||||
|
|
||||||
// Since family has a join table, we will first left join all family members and then do the WITH clause on the target entity table join
|
// Since family has a join table, we will first left join all family members and then do the WITH clause on the target entity table join
|
||||||
// Normally this produces 2 results which is wrong and can only be circumvented by converting the join table and target entity table join to a subquery
|
// Normally this produces 2 results which is wrong and can only be circumvented by converting the join table and target entity table join to a subquery
|
||||||
List list = s.createQuery("from Human h left join h.family as f with key(f) like 'son1' where h.description = 'father'")
|
List list = s.createQuery( "from Human h left join h.family as f with key(f) like 'son1' where h.description = 'father'" )
|
||||||
.list();
|
.list();
|
||||||
assertEquals("subquery rewriting of join table was not disabled", 2, list.size());
|
assertEquals( "subquery rewriting of join table was not disabled", 2, list.size() );
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
s.close();
|
s.close();
|
||||||
|
|
||||||
data.cleanup();
|
data.cleanup();
|
||||||
|
} finally {
|
||||||
|
// Rebuild to reset the properties
|
||||||
|
rebuildSessionFactory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestData {
|
private class TestData {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user