File tree Expand file tree Collapse file tree 3 files changed +79
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections
hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 12
12
import org .hibernate .metamodel .MappingMetamodel ;
13
13
14
14
import org .hibernate .testing .orm .domain .StandardDomainModel ;
15
+ import org .hibernate .testing .orm .domain .gambit .EntityOfArrays ;
15
16
import org .hibernate .testing .orm .domain .gambit .EntityOfSets ;
16
17
import org .hibernate .testing .orm .domain .gambit .EntityOfMaps ;
17
18
import org .hibernate .testing .orm .domain .gambit .EntityOfLists ;
35
36
@ SuppressWarnings ("WeakerAccess" )
36
37
public class PluralAttributeMappingTests {
37
38
39
+ @ Test
40
+ public void testArrays (SessionFactoryScope scope ) {
41
+ final MappingMetamodel domainModel = scope .getSessionFactory ().getDomainModel ();
42
+ final EntityMappingType containerEntityDescriptor = domainModel .getEntityDescriptor ( EntityOfArrays .class );
43
+
44
+ assertThat ( containerEntityDescriptor .getNumberOfAttributeMappings (), is ( 2 ) );
45
+
46
+ final AttributeMapping arrayOfBasics = containerEntityDescriptor .findAttributeMapping ( "arrayOfBasics" );
47
+ assertThat ( arrayOfBasics , notNullValue () );
48
+ }
49
+
38
50
@ Test
39
51
public void testLists (SessionFactoryScope scope ) {
40
52
final MappingMetamodel domainModel = scope .getSessionFactory ().getDomainModel ();
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Hibernate, Relational Persistence for Idiomatic Java
3
+ *
4
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later
5
+ * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
6
+ */
7
+ package org .hibernate .testing .orm .domain .gambit ;
8
+
9
+ import javax .persistence .ElementCollection ;
10
+ import javax .persistence .Entity ;
11
+ import javax .persistence .Id ;
12
+ import javax .persistence .OrderColumn ;
13
+
14
+ /**
15
+ * @author Koen Aers
16
+ */
17
+ @ SuppressWarnings ("unused" )
18
+ @ Entity
19
+ public class EntityOfArrays {
20
+
21
+ private Integer id ;
22
+ private String name ;
23
+
24
+ private String [] arrayOfBasics ;
25
+
26
+
27
+ public EntityOfArrays () {
28
+ }
29
+
30
+ public EntityOfArrays (Integer id , String name ) {
31
+ this .id = id ;
32
+ this .name = name ;
33
+ }
34
+
35
+ @ Id
36
+ public Integer getId () {
37
+ return id ;
38
+ }
39
+
40
+ public void setId (Integer id ) {
41
+ this .id = id ;
42
+ }
43
+
44
+ public String getName () {
45
+ return name ;
46
+ }
47
+
48
+ public void setName (String name ) {
49
+ this .name = name ;
50
+ }
51
+
52
+
53
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
+ // arrayOfBasics
55
+
56
+ @ ElementCollection
57
+ @ OrderColumn
58
+ public String [] getArrayOfBasics () {
59
+ return arrayOfBasics ;
60
+ }
61
+
62
+ public void setArrayOfBasics (String [] arrayOfBasics ) {
63
+ this .arrayOfBasics = arrayOfBasics ;
64
+ }
65
+
66
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public GambitDomainModel() {
19
19
BasicEntity .class ,
20
20
Component .class ,
21
21
EmbeddedIdEntity .class ,
22
+ EntityOfArrays .class ,
22
23
EntityOfBasics .class ,
23
24
EntityOfComposites .class ,
24
25
EntityOfDynamicComponent .class ,
You can’t perform that action at this time.
0 commit comments