mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 21:24:49 +00:00
HHH-16754 Add test for issue
This commit is contained in:
parent
899bf1efa5
commit
1126438604
@ -16,6 +16,7 @@
|
|||||||
import org.hibernate.testing.orm.domain.gambit.EntityOfLists;
|
import org.hibernate.testing.orm.domain.gambit.EntityOfLists;
|
||||||
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
|
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
|
||||||
import org.hibernate.testing.orm.junit.DomainModel;
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
|
import org.hibernate.testing.orm.junit.Jira;
|
||||||
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
|
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
@ -160,4 +161,33 @@ public void testUnionAllLimitNested(SessionFactoryScope scope) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsUnion.class)
|
||||||
|
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsOrderByInSubquery.class)
|
||||||
|
@Jira( "https://hibernate.atlassian.net/browse/HHH-16754" )
|
||||||
|
public void testUnionAllSubqueryOrderByPath(SessionFactoryScope scope) {
|
||||||
|
scope.inSession(
|
||||||
|
session -> {
|
||||||
|
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
|
||||||
|
|
||||||
|
JpaCriteriaQuery<EntityOfLists> query1 = cb.createQuery( EntityOfLists.class );
|
||||||
|
JpaRoot<EntityOfLists> root1 = query1.from( EntityOfLists.class );
|
||||||
|
query1.where( cb.equal( root1.get( "id" ), 1 ) );
|
||||||
|
|
||||||
|
JpaCriteriaQuery<EntityOfLists> query2 = cb.createQuery( EntityOfLists.class );
|
||||||
|
JpaRoot<EntityOfLists> root2 = query2.from( EntityOfLists.class );
|
||||||
|
query2.where( cb.equal( root2.get( "id" ), 2 ) );
|
||||||
|
|
||||||
|
List<EntityOfLists> list = session.createQuery(
|
||||||
|
cb.unionAll(
|
||||||
|
query1,
|
||||||
|
query2.orderBy( cb.asc( root2.get("name") ) )
|
||||||
|
.fetch( 1 )
|
||||||
|
)
|
||||||
|
).list();
|
||||||
|
assertThat( list.size(), is( 2 ) );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user