1919import jakarta .persistence .Convert ;
2020import jakarta .persistence .Converter ;
2121import jakarta .persistence .Entity ;
22+ import jakarta .persistence .EnumType ;
23+ import jakarta .persistence .Enumerated ;
2224import jakarta .persistence .Id ;
2325
2426import static org .assertj .core .api .Assertions .assertThat ;
3335@ SessionFactory
3436@ Jira ( "https://hibernate.atlassian.net/browse/HHH-17332" )
3537@ Jira ( "https://hibernate.atlassian.net/browse/HHH-17701" )
38+ @ Jira ( "https://hibernate.atlassian.net/browse/HHH-17803" )
3639public class InSubqueryPredicateAnonymousTupleTest {
3740 @ BeforeAll
3841 public void setUp (SessionFactoryScope scope ) {
3942 scope .inTransaction ( session -> {
4043 session .persist ( new BasicEntity ( 1 , "test" ) );
41- session .persist ( new TestEntity ( 1L , new Money ( 100L ) ) );
44+ session .persist ( new TestEntity ( 1L , new Money ( 100L ), Status . VALID ) );
4245 } );
4346 }
4447
@@ -84,6 +87,18 @@ public void testConvertedAttributeTuple(SessionFactoryScope scope) {
8487 } );
8588 }
8689
90+ @ Test
91+ public void testEnumeratedAttributeTuple (SessionFactoryScope scope ) {
92+ scope .inTransaction ( session -> {
93+ final TestEntity result = session .createQuery (
94+ "select t from TestEntity t where (t.id, t.status) in " +
95+ "(select t2.id, t2.status from TestEntity t2)" ,
96+ TestEntity .class
97+ ).getSingleResult ();
98+ assertThat ( result .getStatus () ).isEqualTo ( Status .VALID );
99+ } );
100+ }
101+
87102 @ Entity ( name = "TestEntity" )
88103 public static class TestEntity {
89104 @ Id
@@ -92,17 +107,29 @@ public static class TestEntity {
92107 @ Convert ( converter = MoneyConverter .class )
93108 private Money money ;
94109
110+ @ Enumerated ( EnumType .STRING )
111+ private Status status ;
112+
95113 public TestEntity () {
96114 }
97115
98- public TestEntity (Long id , Money money ) {
116+ public TestEntity (Long id , Money money , Status status ) {
99117 this .id = id ;
100118 this .money = money ;
119+ this .status = status ;
101120 }
102121
103122 public Money getMoney () {
104123 return money ;
105124 }
125+
126+ public Status getStatus () {
127+ return status ;
128+ }
129+ }
130+
131+ public enum Status {
132+ VALID , INVALID
106133 }
107134
108135 public static class Money {
0 commit comments