File tree Expand file tree Collapse file tree 23 files changed +338
-288
lines changed
main/resources/org/hibernate/xsd/mapping
java/org/hibernate/orm/test/collection
resources/org/hibernate/orm/test/collection Expand file tree Collapse file tree 23 files changed +338
-288
lines changed Original file line number Diff line number Diff line change 3302
3302
</xsd : choice >
3303
3303
<xsd : choice >
3304
3304
<xsd : sequence >
3305
- <xsd : element name =" map-key-column" type =" orm:map-key-column" minOccurs =" 0" />
3305
+ <xsd : choice minOccurs =" 0" >
3306
+ <xsd : element name =" map-key-column" type =" orm:map-key-column" minOccurs =" 0" />
3307
+ <xsd : element name =" map-key-formula" type =" xsd:string" minOccurs =" 0" />
3308
+ </xsd : choice >
3306
3309
<xsd : element name =" map-key-type" type =" orm:user-type" minOccurs =" 0" />
3307
3310
</xsd : sequence >
3308
3311
<xsd : sequence >
Original file line number Diff line number Diff line change 19
19
20
20
import static org .assertj .core .api .AssertionsForClassTypes .assertThat ;
21
21
22
+ @ SuppressWarnings ("JUnitMalformedDeclaration" )
22
23
@ DomainModel (
23
- xmlMappings = "org/hibernate/orm/test/collection/list/ParentChildMapping.hbm. xml"
24
+ xmlMappings = "org/hibernate/orm/test/collection/list/ParentChildMapping.xml"
24
25
)
25
26
@ SessionFactory
26
27
public class IterateOverListInTheSetMethodTest {
27
28
28
29
@ AfterEach
29
30
public void tearDown (SessionFactoryScope scope ) {
30
- scope .inTransaction (
31
- session -> {
32
- session .createMutationQuery ( "delete from Child" ).executeUpdate ();
33
- session .createMutationQuery ( "delete from Parent" ).executeUpdate ();
34
- }
35
- );
31
+ scope .dropData ();
36
32
}
37
33
38
34
Original file line number Diff line number Diff line change 32
32
*
33
33
* @author Steve Ebersole
34
34
*/
35
- @ DomainModel (
36
- xmlMappings = "org/hibernate/orm/test/collection/list/Mappings.hbm.xml"
37
- )
35
+ @ SuppressWarnings ("JUnitMalformedDeclaration" )
36
+ @ DomainModel (xmlMappings = "org/hibernate/orm/test/collection/list/Mappings.xml" )
38
37
@ SessionFactory
39
38
public class PersistentListTest {
40
39
@@ -131,9 +130,9 @@ public void testInverseListIndex2(SessionFactoryScope scope) {
131
130
connection -> {
132
131
SimpleSelect select = new SimpleSelect ( sessionFactory )
133
132
.setTableName ( collectionPersister .getTableName () )
134
- .addColumn ( "order_id " )
135
- .addColumn ( "INDX " )
136
- .addColumn ( "PRD_CODE " );
133
+ .addColumn ( "order_fk " )
134
+ .addColumn ( "list_index " )
135
+ .addColumn ( "prod_code " );
137
136
final String sql = select .toStatementString ();
138
137
PreparedStatement preparedStatement = ( (SessionImplementor ) session2 ).getJdbcCoordinator ()
139
138
.getStatementPreparer ()
Original file line number Diff line number Diff line change 13
13
*/
14
14
public class Parent {
15
15
private String name ;
16
- private Map children = new HashMap ();
16
+ private Map < String , Child > children = new HashMap <> ();
17
17
18
18
public Parent () {
19
19
}
@@ -30,11 +30,11 @@ public void setName(String name) {
30
30
this .name = name ;
31
31
}
32
32
33
- public Map getChildren () {
33
+ public Map < String , Child > getChildren () {
34
34
return children ;
35
35
}
36
36
37
- public void setChildren (Map children ) {
37
+ public void setChildren (Map < String , Child > children ) {
38
38
this .children = children ;
39
39
}
40
40
Original file line number Diff line number Diff line change 43
43
* @author Gail Badner
44
44
*/
45
45
@ DomainModel (
46
- xmlMappings = "org/hibernate/orm/test/collection/map/Mappings.hbm. xml" ,
46
+ xmlMappings = "org/hibernate/orm/test/collection/map/Mappings.xml" ,
47
47
annotatedClasses = {
48
48
PersistentMapTest .User .class ,
49
49
PersistentMapTest .UserData .class ,
Original file line number Diff line number Diff line change 28
28
/**
29
29
* @author Gavin King
30
30
*/
31
+ @ SuppressWarnings ("JUnitMalformedDeclaration" )
31
32
@ RequiresDialectFeature (feature = DialectFeatureChecks .SupportsNoColumnInsert .class )
32
33
@ DomainModel (xmlMappings = {
33
34
"org/hibernate/orm/test/collection/original/UserPermissions.hbm.xml" ,
34
- "org/hibernate/orm/test/collection/original/Zoo.hbm. xml" ,
35
+ "org/hibernate/orm/test/collection/original/Zoo.xml" ,
35
36
})
36
37
@ SessionFactory
37
38
public class CollectionTest {
Original file line number Diff line number Diff line change 8
8
9
9
public class Zoo {
10
10
long id ;
11
- List animals = new ArrayList ();
11
+ List < Animal > animals = new ArrayList <> ();
12
12
13
13
public long getId () {
14
14
return id ;
15
15
}
16
16
public void setId ( long id ) {
17
17
this .id = id ;
18
18
}
19
- public List getAnimals () {
19
+ public List < Animal > getAnimals () {
20
20
return animals ;
21
21
}
22
- public void setAnimals (List animals ) {
22
+ public void setAnimals (List < Animal > animals ) {
23
23
this .animals = animals ;
24
24
}
25
25
Original file line number Diff line number Diff line change 13
13
*/
14
14
public class Parent {
15
15
private String name ;
16
- private Set children = new HashSet ();
16
+ private Set < Child > children = new HashSet <> ();
17
17
18
18
public Parent () {
19
19
}
@@ -30,11 +30,11 @@ public void setName(String name) {
30
30
this .name = name ;
31
31
}
32
32
33
- public Set getChildren () {
33
+ public Set < Child > getChildren () {
34
34
return children ;
35
35
}
36
36
37
- public void setChildren (Set children ) {
37
+ public void setChildren (Set < Child > children ) {
38
38
this .children = children ;
39
39
}
40
40
}
Original file line number Diff line number Diff line change 10
10
*/
11
11
12
12
import org .hibernate .testing .orm .junit .DomainModel ;
13
+ import org .hibernate .testing .orm .junit .FailureExpected ;
14
+ import org .hibernate .testing .orm .junit .JiraKey ;
13
15
import org .hibernate .testing .orm .junit .SessionFactory ;
14
16
import org .hibernate .testing .orm .junit .SessionFactoryScope ;
15
17
import org .junit .jupiter .api .Test ;
16
18
19
+ @ SuppressWarnings ("JUnitMalformedDeclaration" )
17
20
@ DomainModel (
18
- xmlMappings = "org/hibernate/orm/test/collection/set/Mappings.hbm .xml" ,
21
+ xmlMappings = "org/hibernate/orm/test/collection/set/MappingsNonLazy .xml" ,
19
22
concurrencyStrategy = "nonstrict-read-write"
20
23
)
21
24
@ SessionFactory (generateStatistics = true )
22
25
public class PersistentSetNonLazyTest extends PersistentSetTest {
23
26
24
27
@ Test
25
- // @FailureExpected(
26
- // jiraKey = "HHH-3799",
27
- // reason = "known to fail with non-lazy collection using query cache"
28
- // )
28
+ @ JiraKey ("HHH-3799" )
29
+ @ FailureExpected (reason = "known to fail with non-lazy collection using query cache" )
29
30
public void testLoadChildCheckParentContainsChildCache (SessionFactoryScope scope ) {
30
31
super .testLoadChildCheckParentContainsChildCache ( scope );
31
32
}
Original file line number Diff line number Diff line change 31
31
/**
32
32
* @author Steve Ebersole
33
33
*/
34
- @ DomainModel (
35
- xmlMappings = "org/hibernate/orm/test/collection/set/Mappings.hbm.xml"
36
- )
34
+ @ SuppressWarnings ("JUnitMalformedDeclaration" )
35
+ @ DomainModel (xmlMappings = "org/hibernate/orm/test/collection/set/Mappings.xml" )
37
36
@ SessionFactory (generateStatistics = true )
38
- @ ServiceRegistry (
39
- settings = {
40
- @ Setting (
41
- name = AvailableSettings .USE_SECOND_LEVEL_CACHE , value = "true"
42
- ),
43
- @ Setting (
44
- name = AvailableSettings .USE_QUERY_CACHE , value = "true"
45
- )
46
- }
47
- )
37
+ @ ServiceRegistry (settings = {
38
+ @ Setting (
39
+ name = AvailableSettings .USE_SECOND_LEVEL_CACHE , value = "true"
40
+ ),
41
+ @ Setting (
42
+ name = AvailableSettings .USE_QUERY_CACHE , value = "true"
43
+ )
44
+ })
48
45
public class PersistentSetTest {
49
46
50
47
@ Test
Original file line number Diff line number Diff line change 43
43
</entity-mappings >
44
44
45
45
46
-
47
-
48
- <!-- <!DOCTYPE hibernate-mapping PUBLIC-->
49
- <!-- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"-->
50
- <!-- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">-->
51
- <!-- <hibernate-mapping package="org.hibernate.orm.test.collection.lazynocascade">-->
52
- <!-- <class name="Parent">-->
53
- <!-- <id name="id" column="parent_id">-->
54
- <!-- <generator class="increment"/>-->
55
- <!-- </id>-->
56
- <!-- <set name="children" cascade="all">-->
57
- <!-- <key column="parent_id"/>-->
58
- <!-- <one-to-many class="BaseChild"/>-->
59
- <!-- </set>-->
60
- <!-- </class>-->
61
-
62
- <!-- <class name="BaseChild" >-->
63
- <!-- <id name="id" column="base_child_id">-->
64
- <!-- <generator class="increment"/>-->
65
- <!-- </id>-->
66
- <!-- <discriminator/>-->
67
- <!-- <many-to-one name="dependency" column="dependency_id" class="BaseChild" lazy="proxy"/>-->
68
- <!-- <subclass name="Child">-->
69
- <!-- <property name="name" column="name" type="string"/>-->
70
- <!-- </subclass>-->
71
- <!-- </class>-->
72
- <!-- </hibernate-mapping>-->
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ ~ SPDX-License-Identifier: Apache-2.0
4
+ ~ Copyright Red Hat Inc. and Hibernate Authors
5
+ -->
6
+ <entity-mappings xmlns =" http://www.hibernate.org/xsd/orm/mapping"
7
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
8
+ version =" 7.0" >
9
+ <package >org.hibernate.orm.test.collection.list</package >
10
+
11
+ <entity class =" ListOwner" >
12
+ <attributes >
13
+ <id name =" name" />
14
+ <many-to-one name =" parent" >
15
+ <join-column name =" parent_fk" />
16
+ </many-to-one >
17
+ <one-to-many name =" children" mapped-by =" parent" target-entity =" ListOwner" >
18
+ <order-column name =" list_index" />
19
+ <cascade >
20
+ <cascade-all />
21
+ </cascade >
22
+ </one-to-many >
23
+ </attributes >
24
+ </entity >
25
+
26
+ <entity class =" Order" >
27
+ <table name =" orders" />
28
+ <attributes >
29
+ <id name =" id" >
30
+ <generated-value generator =" increment" />
31
+ </id >
32
+ <basic name =" code" />
33
+ <one-to-many name =" lineItems" mapped-by =" order" >
34
+ <order-column name =" list_index" />
35
+ <cascade >
36
+ <cascade-all />
37
+ </cascade >
38
+ </one-to-many >
39
+ </attributes >
40
+ </entity >
41
+
42
+ <entity class =" LineItem" >
43
+ <table name =" line_items" />
44
+ <attributes >
45
+ <id name =" id" >
46
+ <generated-value generator =" increment" />
47
+ </id >
48
+ <basic name =" productCode" >
49
+ <column name =" prod_code" />
50
+ </basic >
51
+ <basic name =" quantity" >
52
+ <column name =" qty" />
53
+ </basic >
54
+ <many-to-one name =" order" >
55
+ <join-column name =" order_fk" />
56
+ <cascade >
57
+ <cascade-all />
58
+ </cascade >
59
+ </many-to-one >
60
+ </attributes >
61
+ </entity >
62
+ </entity-mappings >
63
+
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments