Skip to content

Commit 28b495c

Browse files
committed
HHH-19324 - Switch tests using hbm.xml to use mapping.xml
1 parent c6119fd commit 28b495c

File tree

3 files changed

+64
-49
lines changed

3 files changed

+64
-49
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/array/ArrayTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
*/
55
package org.hibernate.orm.test.array;
66

7-
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
87
import org.hibernate.testing.orm.junit.DomainModel;
9-
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
108
import org.hibernate.testing.orm.junit.SessionFactory;
119
import org.hibernate.testing.orm.junit.SessionFactoryScope;
1210
import org.junit.jupiter.api.Test;
@@ -17,10 +15,8 @@
1715
/**
1816
* @author Emmanuel Bernard
1917
*/
20-
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsNoColumnInsert.class)
21-
@DomainModel(
22-
xmlMappings = "org/hibernate/orm/test/array/A.hbm.xml"
23-
)
18+
@SuppressWarnings("JUnitMalformedDeclaration")
19+
@DomainModel(xmlMappings = "org/hibernate/orm/test/array/A.xml")
2420
@SessionFactory
2521
public class ArrayTest {
2622

@@ -37,7 +33,7 @@ public void testArrayJoinFetch(SessionFactoryScope scope) {
3733

3834
scope.inTransaction(
3935
session -> {
40-
A retrieved = session.get( A.class, a.getId() );
36+
A retrieved = session.find( A.class, a.getId() );
4137
assertNotNull( retrieved );
4238
assertNotNull( retrieved.getBs() );
4339
assertEquals( 1, retrieved.getBs().length );

hibernate-core/src/test/resources/org/hibernate/orm/test/array/A.hbm.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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.array</package>
10+
11+
<entity class="A">
12+
<table name="aaa"/>
13+
<attributes>
14+
<id name="id">
15+
<generated-value generator="increment"/>
16+
</id>
17+
<one-to-many name="bs" target-entity="B" fetch-mode="JOIN">
18+
<join-column name="a_fk"/>
19+
<order-column name="idx"/>
20+
<cascade>
21+
<cascade-all/>
22+
</cascade>
23+
</one-to-many>
24+
</attributes>
25+
</entity>
26+
27+
<entity class="B">
28+
<table name="bbb"/>
29+
<attributes>
30+
<id name="id">
31+
<generated-value generator="increment"/>
32+
</id>
33+
</attributes>
34+
</entity>
35+
</entity-mappings>
36+
37+
<!--<hibernate-mapping -->
38+
<!-- package="org.hibernate.orm.test.array">-->
39+
<!-- -->
40+
<!-- <class name="A" lazy="true" table="aaa">-->
41+
<!-- -->
42+
<!-- <id name="id">-->
43+
<!-- <generator class="native"/>-->
44+
<!-- </id>-->
45+
46+
<!-- <array name="bs" cascade="all" fetch="join">-->
47+
<!-- <key column="a_id"/>-->
48+
<!-- <list-index column="idx"/>-->
49+
<!-- <one-to-many class="B"/>-->
50+
<!-- </array>-->
51+
52+
<!-- </class>-->
53+
54+
<!-- <class name="B" lazy="true" table="bbb">-->
55+
<!-- <id name="id">-->
56+
<!-- <generator class="native"/>-->
57+
<!-- </id>-->
58+
<!-- </class>-->
59+
60+
61+
<!--</hibernate-mapping>-->

0 commit comments

Comments
 (0)