File tree Expand file tree Collapse file tree 4 files changed +34
-4
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria Expand file tree Collapse file tree 4 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 10
10
11
11
import static org .junit .jupiter .api .Assertions .assertEquals ;
12
12
13
- @ Jpa ()
13
+ @ Jpa
14
14
class CastTest {
15
15
@ Test void testCastToString (EntityManagerFactoryScope scope ) {
16
16
scope .inEntityManager ( entityManager -> {
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ public void testPad(SessionFactoryScope scope) {
273
273
@ Test
274
274
public void testLeftRight (SessionFactoryScope scope ) {
275
275
scope .inTransaction ( session -> {
276
- HibernateCriteriaBuilder cb = session .getCriteriaBuilder ();
276
+ CriteriaBuilder cb = session .getCriteriaBuilder ();
277
277
CriteriaQuery <Tuple > query = cb .createTupleQuery ();
278
278
Root <EntityOfBasics > from = query .from ( EntityOfBasics .class );
279
279
@@ -293,7 +293,7 @@ public void testLeftRight(SessionFactoryScope scope) {
293
293
@ RequiresDialectFeature (feature = DialectFeatureChecks .SupportsReplace .class )
294
294
public void testReplace (SessionFactoryScope scope ) {
295
295
scope .inTransaction ( session -> {
296
- HibernateCriteriaBuilder cb = session .getCriteriaBuilder ();
296
+ CriteriaBuilder cb = session .getCriteriaBuilder ();
297
297
CriteriaQuery <Tuple > query = cb .createTupleQuery ();
298
298
Root <EntityOfBasics > from = query .from ( EntityOfBasics .class );
299
299
Original file line number Diff line number Diff line change 18
18
import static org .junit .jupiter .api .Assertions .assertEquals ;
19
19
import static org .junit .jupiter .api .Assertions .assertInstanceOf ;
20
20
21
- @ Jpa ()
21
+ @ Jpa
22
22
class ExtractTest {
23
23
@ Test void testLocalDate (EntityManagerFactoryScope scope ) {
24
24
scope .inEntityManager ( entityManager -> {
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 .criteria ;
6
+
7
+ import org .hibernate .testing .orm .junit .EntityManagerFactoryScope ;
8
+ import org .hibernate .testing .orm .junit .Jpa ;
9
+ import org .junit .jupiter .api .Test ;
10
+
11
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
12
+
13
+ @ Jpa
14
+ class LeftRightReplaceTest {
15
+ @ Test void testLeftRightReplace (EntityManagerFactoryScope scope ) {
16
+ scope .inEntityManager ( entityManager -> {
17
+ var builder = entityManager .getCriteriaBuilder ();
18
+ var query = builder .createQuery ( Object [].class );
19
+ query .select ( builder .array (
20
+ builder .left ( builder .literal ( "Hibernate in Action" ), 9 ),
21
+ builder .right ( builder .literal ( "Hibernate in Action" ), 6 ),
22
+ builder .replace ( builder .literal ( "Hibernate in Action" ), "Action" , "Quarkus" )
23
+ ) );
24
+ var result = entityManager .createQuery ( query ).getSingleResult ();
25
+ assertEquals ( "Hibernate" , result [0 ] );
26
+ assertEquals ( "Action" , result [1 ] );
27
+ assertEquals ("Hibernate in Quarkus" , result [2 ] );
28
+ } );
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments