File tree Expand file tree Collapse file tree 8 files changed +163
-6
lines changed
boot/model/source/internal/hbm
java/org/hibernate/test/entitymode/dom4j
resources/org/hibernate/test/entitymode/dom4j
hibernate-testing/src/main/java/org/hibernate/testing/logger Expand file tree Collapse file tree 8 files changed +163
-6
lines changed Original file line number Diff line number Diff line change @@ -1884,7 +1884,7 @@ public String getPropertyAccessorName() {
1884
1884
attribute
1885
1885
);
1886
1886
1887
- if ( StringHelper .isNotEmpty ( embeddedSource .getName () ) ) {
1887
+ if ( StringHelper .isNotEmpty ( embeddedSource .getXmlNodeName () ) ) {
1888
1888
DeprecationLogger .DEPRECATION_LOGGER .logDeprecationOfDomEntityModeSupport ();
1889
1889
}
1890
1890
@@ -2437,7 +2437,7 @@ private void bindProperty(
2437
2437
Property property ) {
2438
2438
property .setName ( propertySource .getName () );
2439
2439
2440
- if ( StringHelper .isNotEmpty ( propertySource .getName () ) ) {
2440
+ if ( StringHelper .isNotEmpty ( propertySource .getXmlNodeName () ) ) {
2441
2441
DeprecationLogger .DEPRECATION_LOGGER .logDeprecationOfDomEntityModeSupport ();
2442
2442
}
2443
2443
Original file line number Diff line number Diff line change 6
6
*/
7
7
package org .hibernate .internal .log ;
8
8
9
+ import org .jboss .logging .BasicLogger ;
9
10
import org .jboss .logging .Logger ;
10
11
import org .jboss .logging .annotations .LogMessage ;
11
12
import org .jboss .logging .annotations .Message ;
22
23
*/
23
24
@ MessageLogger ( projectCode = "HHH" )
24
25
@ ValidIdRange ( min = 90000001 , max = 90001000 )
25
- public interface DeprecationLogger {
26
+ public interface DeprecationLogger extends BasicLogger {
26
27
public static final DeprecationLogger DEPRECATION_LOGGER = Logger .getMessageLogger (
27
28
DeprecationLogger .class ,
28
29
"org.hibernate.orm.deprecation"
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 .test .entitymode .dom4j ;
8
+
9
+ /**
10
+ * @author Carsten Hammer
11
+ * @author Steve Ebersole
12
+ */
13
+ public class Car {
14
+ protected Long id ;
15
+ protected Long quantity ;
16
+ protected Component component ;
17
+
18
+ public Long getId () {
19
+ return this .id ;
20
+ }
21
+
22
+ public void setId (Long id ) {
23
+ this .id = id ;
24
+ }
25
+
26
+ public Long getQuantity () {
27
+ return quantity ;
28
+ }
29
+
30
+ public void setQuantity (Long quantity ) {
31
+ this .quantity = quantity ;
32
+ }
33
+
34
+ public Component getComponent () {
35
+ return component ;
36
+ }
37
+
38
+ public void setComponent (Component component ) {
39
+ this .component = component ;
40
+ }
41
+ }
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 .test .entitymode .dom4j ;
8
+
9
+ /**
10
+ * @author Steve Ebersole
11
+ */
12
+ public class Component {
13
+ private String something ;
14
+ private String somethingElse ;
15
+
16
+ public String getSomething () {
17
+ return something ;
18
+ }
19
+
20
+ public void setSomething (String something ) {
21
+ this .something = something ;
22
+ }
23
+
24
+ public String getSomethingElse () {
25
+ return somethingElse ;
26
+ }
27
+
28
+ public void setSomethingElse (String somethingElse ) {
29
+ this .somethingElse = somethingElse ;
30
+ }
31
+ }
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 .test .entitymode .dom4j ;
8
+
9
+ import org .hibernate .boot .MetadataSources ;
10
+ import org .hibernate .internal .log .DeprecationLogger ;
11
+
12
+ import org .hibernate .testing .junit4 .BaseUnitTestCase ;
13
+ import org .hibernate .testing .logger .LoggerInspectionRule ;
14
+ import org .junit .Rule ;
15
+ import org .junit .Test ;
16
+
17
+ /**
18
+ * Tests that {@code hbm.xml} mappings that do not specify dom4j entity-mode information
19
+ * do not trigger deprecation logging
20
+ *
21
+ * @author Steve Ebersole
22
+ */
23
+ public class DeprecationLoggingTest extends BaseUnitTestCase {
24
+ @ Rule
25
+ public LoggerInspectionRule logInspection = new LoggerInspectionRule ( DeprecationLogger .DEPRECATION_LOGGER );
26
+
27
+ @ Test
28
+ public void basicTest () {
29
+ logInspection .registerListener ( LogListenerImpl .INSTANCE );
30
+
31
+ new MetadataSources ().addResource ( "org/hibernate/test/entitymode/dom4j/Car.hbm.xml" )
32
+ .buildMetadata ();
33
+ }
34
+ }
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 .test .entitymode .dom4j ;
8
+
9
+ import org .hibernate .testing .logger .LogListener ;
10
+
11
+ import org .jboss .logging .Logger ;
12
+
13
+ /**
14
+ * @author Steve Ebersole
15
+ */
16
+ public class LogListenerImpl implements LogListener {
17
+ /**
18
+ * Singleton access
19
+ */
20
+ public static final LogListenerImpl INSTANCE = new LogListenerImpl ();
21
+
22
+ @ Override
23
+ public void loggedEvent (Logger .Level level , String renderedMessage , Throwable thrown ) {
24
+ if ( renderedMessage != null && renderedMessage .startsWith ( "HHH90000003: " ) ) {
25
+ throw new AssertionError ( "Deprecation message was triggered" );
26
+ }
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ ~ Hibernate, Relational Persistence for Idiomatic Java
4
+ ~
5
+ ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
6
+ ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
7
+ -->
8
+ <hibernate-mapping xmlns =" http://www.hibernate.org/xsd/hibernate-mapping" package =" org.hibernate.test.entitymode.dom4j" >
9
+ <class name =" Car" table =" Car" >
10
+ <cache usage =" nonstrict-read-write" region =" org.hibernate.test.entitymode.dom4j.Car" />
11
+ <id name =" id" column =" id" type =" java.lang.Long" >
12
+ <generator class =" native" >
13
+ <param name =" sequence" >cat_id_sequence</param >
14
+ </generator >
15
+ </id >
16
+ <property name =" quantity" type =" java.lang.Long" >
17
+ <column name =" quantity" />
18
+ </property >
19
+ <component name =" component" class =" Component" >
20
+ <property name =" something" />
21
+ <property name =" somethingElse" />
22
+ </component >
23
+ </class >
24
+ </hibernate-mapping >
Original file line number Diff line number Diff line change 8
8
9
9
import org .jboss .logging .Logger .Level ;
10
10
11
- interface LogListener {
12
-
11
+ public interface LogListener {
13
12
void loggedEvent (Level level , String renderedMessage , Throwable thrown );
14
-
15
13
}
You can’t perform that action at this time.
0 commit comments