Skip to content

Commit 3a4e16a

Browse files
committed
HHH-19324 - Switch tests using hbm.xml to use mapping.xml
1 parent e70ff15 commit 3a4e16a

File tree

9 files changed

+69
-241
lines changed

9 files changed

+69
-241
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/cfg/CacheableFileTest.java

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.orm.test.cfg;
6+
7+
import org.hibernate.metamodel.mapping.AttributeMapping;
8+
import org.hibernate.persister.entity.EntityPersister;
9+
import org.hibernate.testing.orm.junit.DomainModel;
10+
import org.hibernate.testing.orm.junit.JiraKey;
11+
import org.hibernate.testing.orm.junit.SessionFactory;
12+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
13+
import org.junit.jupiter.api.Test;
14+
15+
import static org.assertj.core.api.Assertions.assertThat;
16+
17+
/**
18+
* @author Chris Cranford
19+
*/
20+
@SuppressWarnings("JUnitMalformedDeclaration")
21+
@JiraKey(value ="HHH-12199")
22+
@DomainModel(xmlMappings = "org/hibernate/orm/test/cfg/FooEntity.xml")
23+
@SessionFactory
24+
public class PropertyAccessTypeDetectionTest {
25+
public static class FooEntity {
26+
public static final String intValue = "intValue";
27+
28+
private Long id;
29+
private Integer _intValue;
30+
31+
public Long getId() { return id; }
32+
public void setId(Long id) { this.id = id; }
33+
34+
public Integer getIntValue() { return _intValue; }
35+
public void setIntValue(Integer intValue) { this._intValue = intValue; }
36+
}
37+
38+
@Test
39+
public void testPropertyAccessIgnoresStaticFields(SessionFactoryScope factoryScope) {
40+
// verify that the entity persister is configured with property intValue as an Integer rather than
41+
// using the static field reference and determining the type to be String.
42+
final EntityPersister entityDescriptor = factoryScope
43+
.getSessionFactory()
44+
.getMappingMetamodel()
45+
.getEntityDescriptor( FooEntity.class );
46+
final AttributeMapping attributeMapping = entityDescriptor.findAttributeMapping( "intValue" );
47+
assertThat( attributeMapping ).isNotNull();
48+
assertThat( attributeMapping.getJavaType().getJavaTypeClass() ).isAssignableFrom( Integer.class );
49+
}
50+
}

hibernate-core/src/test/java/org/hibernate/orm/test/cfg/PropertyAccessTypeDetectionType.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

hibernate-core/src/test/resources/org/hibernate/orm/test/cache/hhh13179/DiscriminatorSubclassPerson.hbm.xml

Lines changed: 0 additions & 27 deletions
This file was deleted.

hibernate-core/src/test/resources/org/hibernate/orm/test/cache/hhh13179/JoinedSubclassPerson.hbm.xml

Lines changed: 0 additions & 28 deletions
This file was deleted.

hibernate-core/src/test/resources/org/hibernate/orm/test/cache/hhh13179/UnionSubclassPerson.hbm.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

hibernate-core/src/test/resources/org/hibernate/orm/test/cfg/Cacheable.hbm.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

hibernate-core/src/test/resources/org/hibernate/orm/test/cfg/FooEntity.hbm.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.cfg</package>
10+
11+
<entity class="PropertyAccessTypeDetectionTest$FooEntity">
12+
<table name="foo_entity"/>
13+
<attributes>
14+
<id name="id"/>
15+
<basic name="intValue" />
16+
</attributes>
17+
</entity>
18+
19+
</entity-mappings>

0 commit comments

Comments
 (0)