File tree Expand file tree Collapse file tree 2 files changed +77
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/annotations/basic Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .hibernate .orm .test .annotations .basic ;
2
+
3
+ import jakarta .persistence .Entity ;
4
+ import jakarta .persistence .Id ;
5
+ import org .hibernate .MappingException ;
6
+ import org .hibernate .testing .orm .junit .DialectFeatureChecks ;
7
+ import org .hibernate .testing .orm .junit .EntityManagerFactoryScope ;
8
+ import org .hibernate .testing .orm .junit .JiraKey ;
9
+ import org .hibernate .testing .orm .junit .Jpa ;
10
+ import org .hibernate .testing .orm .junit .RequiresDialectFeature ;
11
+ import org .junit .jupiter .api .Test ;
12
+
13
+ import java .util .List ;
14
+
15
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
16
+ import static org .junit .jupiter .api .Assertions .fail ;
17
+
18
+ @ JiraKey ("HHH-17739" )
19
+ @ Jpa (annotatedClasses = ListOfByteArrayTest .Broken .class )
20
+ @ RequiresDialectFeature (feature = DialectFeatureChecks .SupportsStandardArrays .class )
21
+ public class ListOfByteArrayTest {
22
+ @ Test void test (EntityManagerFactoryScope scope ) {
23
+ try {
24
+ scope .getEntityManagerFactory ();
25
+ fail ();
26
+ }
27
+ catch (MappingException e ) {
28
+ assertTrue ( e .getMessage ().contains ("binaryList" ) );
29
+ }
30
+ }
31
+ @ Entity
32
+ static class Broken {
33
+ @ Id long id ;
34
+ List <byte []> binaryList ; // this is not supported
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ package org .hibernate .orm .test .annotations .basic ;
2
+
3
+ import jakarta .persistence .Entity ;
4
+ import jakarta .persistence .Id ;
5
+ import org .hibernate .testing .orm .junit .DialectFeatureChecks ;
6
+ import org .hibernate .testing .orm .junit .EntityManagerFactoryScope ;
7
+ import org .hibernate .testing .orm .junit .JiraKey ;
8
+ import org .hibernate .testing .orm .junit .Jpa ;
9
+ import org .hibernate .testing .orm .junit .RequiresDialectFeature ;
10
+ import org .junit .jupiter .api .Test ;
11
+
12
+ import java .util .List ;
13
+
14
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
15
+
16
+ @ JiraKey ("HHH-17739" )
17
+ @ Jpa (annotatedClasses = ListOfStringTest .Unbroken .class )
18
+ @ RequiresDialectFeature (feature = DialectFeatureChecks .SupportsStandardArrays .class )
19
+ public class ListOfStringTest {
20
+ @ Test void test (EntityManagerFactoryScope scope ) {
21
+ scope .inTransaction (entityManager -> {
22
+ entityManager .persist ( new Unbroken ( List .of ("hello" , "world" ) ) );
23
+ });
24
+ scope .inTransaction (entityManager -> {
25
+ assertEquals ( List .of ("hello" , "world" ),
26
+ entityManager .find (Unbroken .class , 0 ).stringList );
27
+ });
28
+
29
+ }
30
+ @ Entity
31
+ static class Unbroken {
32
+ @ Id long id ;
33
+ List <String > stringList ; // this should be OK
34
+
35
+ Unbroken (List <String > stringList ) {
36
+ this .stringList = stringList ;
37
+ }
38
+ Unbroken () {
39
+ }
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments