File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * SPDX-License-Identifier: Apache-2.0
3+ * Copyright Red Hat Inc. and Hibernate Authors
4+ */
5+ package org .hibernate .orm .test .query ;
6+
7+ import jakarta .persistence .Entity ;
8+ import jakarta .persistence .GeneratedValue ;
9+ import jakarta .persistence .Id ;
10+ import org .hibernate .testing .orm .junit .DomainModel ;
11+ import org .hibernate .testing .orm .junit .Jira ;
12+ import org .hibernate .testing .orm .junit .SessionFactory ;
13+ import org .hibernate .testing .orm .junit .SessionFactoryScope ;
14+ import org .junit .jupiter .api .Test ;
15+
16+
17+ @ DomainModel (
18+ annotatedClasses = {
19+ SubQueryShadowingTest .TestEntity .class ,
20+ }
21+ )
22+ @ SessionFactory
23+ public class SubQueryShadowingTest {
24+
25+ @ Test
26+ @ Jira ("https://hibernate.atlassian.net/browse/HHH-19745" )
27+ public void testSelectCase (SessionFactoryScope scope ) {
28+ scope .inTransaction ( session -> {
29+ session .createQuery (
30+ """
31+ from TestEntity t
32+ left join TestEntity t2 on exists (
33+ select 1
34+ from TestEntity t
35+ order by t.id
36+ limit 1
37+ )
38+ """ , TestEntity .class )
39+ .list ();
40+ } );
41+ }
42+
43+ @ Entity (name = "TestEntity" )
44+ public static class TestEntity {
45+
46+ @ Id
47+ @ GeneratedValue
48+ private Long id ;
49+
50+ private String name ;
51+
52+ public TestEntity () {
53+ }
54+
55+ public TestEntity (String name ) {
56+ this .name = name ;
57+ }
58+ }
59+ }
You can’t perform that action at this time.
0 commit comments