HHH-14529 Add a few missing enum mappings for orm.xml

This commit is contained in:
Yoann Rodière 2021-03-26 13:22:09 +01:00
parent bbc25cf28b
commit efe5424d35
4 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,24 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.jaxb.mapping.internal;
import javax.persistence.ConstraintMode;
/**
* Marshalling support for dealing with JPA ConstraintMode enums. Plugged into JAXB for binding
*
* @author Steve Ebersole
*/
public class ConstraintModeMarshalling {
public static ConstraintMode fromXml(String name) {
return ConstraintMode.valueOf( name );
}
public static String toXml(ConstraintMode accessType) {
return accessType.name();
}
}

View File

@ -0,0 +1,24 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.jaxb.mapping.internal;
import javax.persistence.GenerationType;
/**
* Marshalling support for dealing with JPA GenerationType enums. Plugged into JAXB for binding
*
* @author Steve Ebersole
*/
public class GenerationTypeMarshalling {
public static GenerationType fromXml(String name) {
return GenerationType.valueOf( name );
}
public static String toXml(GenerationType accessType) {
return accessType.name();
}
}

View File

@ -0,0 +1,24 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.jaxb.mapping.internal;
import javax.persistence.InheritanceType;
/**
* Marshalling support for dealing with JPA InheritanceType enums. Plugged into JAXB for binding
*
* @author Steve Ebersole
*/
public class InheritanceTypeMarshalling {
public static InheritanceType fromXml(String name) {
return InheritanceType.valueOf( name );
}
public static String toXml(InheritanceType accessType) {
return accessType.name();
}
}

View File

@ -59,6 +59,24 @@
printMethod="org.hibernate.boot.jaxb.mapping.internal.TemporalTypeMarshalling.toXml" />
</bindings>
<bindings node="//xsd:simpleType[@name='inheritance-type']">
<javaType name="javax.persistence.InheritanceType"
parseMethod="org.hibernate.boot.jaxb.mapping.internal.InheritanceTypeMarshalling.fromXml"
printMethod="org.hibernate.boot.jaxb.mapping.internal.InheritanceTypeMarshalling.toXml" />
</bindings>
<bindings node="//xsd:simpleType[@name='generation-type']">
<javaType name="javax.persistence.GenerationType"
parseMethod="org.hibernate.boot.jaxb.mapping.internal.GenerationTypeMarshalling.fromXml"
printMethod="org.hibernate.boot.jaxb.mapping.internal.GenerationTypeMarshalling.toXml" />
</bindings>
<bindings node="//xsd:simpleType[@name='constraint-mode']">
<javaType name="javax.persistence.ContraintMode"
parseMethod="org.hibernate.boot.jaxb.mapping.internal.ContraintModeMarshalling.fromXml"
printMethod="org.hibernate.boot.jaxb.mapping.internal.ContraintModeMarshalling.toXml" />
</bindings>
<bindings node="//xsd:complexType[@name='secondary-table']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.SchemaAware</inheritance:implements>