44 */
55package org .hibernate .orm .test .jpa .query ;
66
7+ import jakarta .persistence .GeneratedValue ;
8+ import jakarta .persistence .Lob ;
79import org .hibernate .testing .orm .junit .EntityManagerFactoryScope ;
810import org .hibernate .testing .orm .junit .Jpa ;
911import org .junit .jupiter .api .Test ;
1719import jakarta .persistence .criteria .Root ;
1820import jakarta .persistence .metamodel .EntityType ;
1921
22+
2023@ Jpa (
21- annotatedClasses = CriteriaUpdateWithParametersTest .Person .class
24+ annotatedClasses = {
25+ CriteriaUpdateWithParametersTest .Person .class ,
26+ CriteriaUpdateWithParametersTest .Process .class
27+ }
2228)
2329public class CriteriaUpdateWithParametersTest {
2430
@@ -76,6 +82,19 @@ public void testCriteriaUpdate2(EntityManagerFactoryScope scope) {
7682 );
7783 }
7884
85+ @ Test
86+ public void testCriteriaUpdate3 (EntityManagerFactoryScope scope ) {
87+ scope .inTransaction ( em -> {
88+ CriteriaBuilder criteriaBuilder = em .getCriteriaBuilder ();
89+ CriteriaUpdate <Process > createCriteriaUpdate = criteriaBuilder .createCriteriaUpdate (
90+ Process .class );
91+ Root <Process > root = createCriteriaUpdate .from ( Process .class );
92+ createCriteriaUpdate .set ( root .get ( "name" ), (Object ) null );
93+ createCriteriaUpdate .set ( root .get ( "payload" ), (Object ) null );
94+ em .createQuery ( createCriteriaUpdate ).executeUpdate ();
95+ } );
96+ }
97+
7998 @ Entity (name = "Person" )
8099 public static class Person {
81100
@@ -101,4 +120,20 @@ public Integer getAge() {
101120 return age ;
102121 }
103122 }
123+
124+ @ Entity
125+ public static class Process {
126+
127+ @ Id
128+ @ GeneratedValue
129+ private Long id ;
130+
131+ // All attributes below are necessary to reproduce the issue
132+
133+ private String name ;
134+
135+ @ Lob
136+ private byte [] payload ;
137+
138+ }
104139}
0 commit comments