HHH-17377 - Migrate to JPA 3.2

https://hibernate.atlassian.net/browse/HHH-17377

XJB changes (JAXB "binding model")
This commit is contained in:
Steve Ebersole 2023-11-17 11:56:48 -06:00
parent 11d83b5af9
commit 33c68b93ab
10 changed files with 217 additions and 75 deletions

View File

@ -80,7 +80,6 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSetType;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSimpleIdType; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSimpleIdType;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTimestampAttributeType; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTimestampAttributeType;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTypeDefinitionType;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmVersionAttributeType; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmVersionAttributeType;
import org.hibernate.boot.jaxb.hbm.spi.PluralAttributeInfo; import org.hibernate.boot.jaxb.hbm.spi.PluralAttributeInfo;
@ -1482,8 +1481,8 @@ public class HbmXmlTransformer {
final JaxbManyToOneImpl m2o = new JaxbManyToOneImpl(); final JaxbManyToOneImpl m2o = new JaxbManyToOneImpl();
m2o.setAttributeAccessor( hbmNode.getAccess() ); m2o.setAttributeAccessor( hbmNode.getAccess() );
m2o.setCascade( convertCascadeType( hbmNode.getCascade() ) ); m2o.setCascade( convertCascadeType( hbmNode.getCascade() ) );
m2o.setForeignKey( new JaxbForeignKeyImpl() ); m2o.setForeignKeys( new JaxbForeignKeyImpl() );
m2o.getForeignKey().setName( hbmNode.getForeignKey() ); m2o.getForeignKeys().setName( hbmNode.getForeignKey() );
transferColumnsAndFormulas( transferColumnsAndFormulas(
new ColumnAndFormulaSource() { new ColumnAndFormulaSource() {
@ -1515,7 +1514,7 @@ public class HbmXmlTransformer {
@Override @Override
public void addColumn(TargetColumnAdapter column) { public void addColumn(TargetColumnAdapter column) {
m2o.getJoinColumn().add( ( (TargetColumnAdapterJaxbJoinColumn) column ).getTargetColumn() ); m2o.getJoinColumns().add( ( (TargetColumnAdapterJaxbJoinColumn) column ).getTargetColumn() );
} }
@Override @Override
@ -2294,15 +2293,15 @@ public class HbmXmlTransformer {
m2o.setName( hbmM2O.getName() ); m2o.setName( hbmM2O.getName() );
m2o.setAttributeAccessor( hbmM2O.getAccess() ); m2o.setAttributeAccessor( hbmM2O.getAccess() );
m2o.setFetch( convert( hbmM2O.getLazy() ) ); m2o.setFetch( convert( hbmM2O.getLazy() ) );
m2o.setForeignKey( new JaxbForeignKeyImpl() ); m2o.setForeignKeys( new JaxbForeignKeyImpl() );
m2o.getForeignKey().setName( hbmM2O.getForeignKey() ); m2o.getForeignKeys().setName( hbmM2O.getForeignKey() );
if ( !hbmM2O.getColumn().isEmpty() ) { if ( !hbmM2O.getColumn().isEmpty() ) {
for ( JaxbHbmColumnType hbmColumn : hbmM2O.getColumn() ) { for ( JaxbHbmColumnType hbmColumn : hbmM2O.getColumn() ) {
final JaxbJoinColumnImpl joinColumn = new JaxbJoinColumnImpl(); final JaxbJoinColumnImpl joinColumn = new JaxbJoinColumnImpl();
joinColumn.setName( hbmColumn.getName() ); joinColumn.setName( hbmColumn.getName() );
joinColumn.setNullable( hbmColumn.isNotNull() == null ? null : !hbmColumn.isNotNull() ); joinColumn.setNullable( hbmColumn.isNotNull() == null ? null : !hbmColumn.isNotNull() );
joinColumn.setUnique( hbmColumn.isUnique() ); joinColumn.setUnique( hbmColumn.isUnique() );
m2o.getJoinColumn().add( joinColumn ); m2o.getJoinColumns().add( joinColumn );
} }
} }
else { else {
@ -2314,7 +2313,7 @@ public class HbmXmlTransformer {
else { else {
joinColumn.setName( hbmM2O.getColumnAttribute() ); joinColumn.setName( hbmM2O.getColumnAttribute() );
} }
m2o.getJoinColumn().add( joinColumn ); m2o.getJoinColumns().add( joinColumn );
} }
if ( isNotEmpty( hbmM2O.getEntityName() ) ) { if ( isNotEmpty( hbmM2O.getEntityName() ) ) {

View File

@ -0,0 +1,22 @@
/*
* 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 org.hibernate.annotations.NotFoundAction;
/**
* @author Steve Ebersole
*/
public class NotFoundActionMarshalling {
public static NotFoundAction fromXml(String name) {
return name == null ? null : NotFoundAction.valueOf( name );
}
public static String toXml(NotFoundAction action) {
return action == null ? null : action.name();
}
}

View File

@ -92,13 +92,11 @@ public interface JaxbEntity extends JaxbEntityOrMappedSuperclass {
String getDiscriminatorFormula(); String getDiscriminatorFormula();
void setDiscriminatorFormula(String value); void setDiscriminatorFormula(String value);
JaxbSequenceGeneratorImpl getSequenceGenerator(); JaxbSequenceGeneratorImpl getSequenceGenerators();
void setSequenceGenerator(JaxbSequenceGeneratorImpl value);
JaxbTableGeneratorImpl getTableGenerator(); JaxbTableGeneratorImpl getTableGenerators();
void setTableGenerator(JaxbTableGeneratorImpl value);
List<JaxbGenericIdGeneratorImpl> getIdentifierGenerator(); List<JaxbGenericIdGeneratorImpl> getIdentifierGenerators();
List<JaxbNamedQueryImpl> getNamedQueries(); List<JaxbNamedQueryImpl> getNamedQueries();
List<JaxbNamedNativeQueryImpl> getNamedNativeQueries(); List<JaxbNamedNativeQueryImpl> getNamedNativeQueries();

View File

@ -24,7 +24,7 @@ public interface JaxbEntityOrMappedSuperclass extends JaxbManagedType, JaxbLifec
void setExcludeSuperclassListeners(JaxbEmptyTypeImpl value); void setExcludeSuperclassListeners(JaxbEmptyTypeImpl value);
JaxbEntityListenersImpl getEntityListeners(); JaxbEntityListenerContainerImpl getEntityListenerContainer();
void setEntityListeners(JaxbEntityListenersImpl value); void setEntityListenerContainer(JaxbEntityListenerContainerImpl value);
} }

View File

@ -6,10 +6,12 @@
*/ */
package org.hibernate.boot.jaxb.mapping.spi; package org.hibernate.boot.jaxb.mapping.spi;
import org.hibernate.annotations.NotFoundAction;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface JaxbNotFoundCapable extends JaxbPersistentAttribute { public interface JaxbNotFoundCapable extends JaxbPersistentAttribute {
JaxbNotFoundEnumImpl getNotFound(); NotFoundAction getNotFound();
void setNotFound(JaxbNotFoundEnumImpl value); void setNotFound(NotFoundAction value);
} }

View File

@ -52,15 +52,15 @@ public interface JaxbPluralAttribute extends JaxbPersistentAttribute, JaxbLockab
void setMapKeyEnumerated(EnumType value); void setMapKeyEnumerated(EnumType value);
List<JaxbAttributeOverrideImpl> getMapKeyAttributeOverride(); List<JaxbAttributeOverrideImpl> getMapKeyAttributeOverrides();
List<JaxbConvertImpl> getMapKeyConvert(); List<JaxbConvertImpl> getMapKeyConverts();
JaxbMapKeyColumnImpl getMapKeyColumn(); JaxbMapKeyColumnImpl getMapKeyColumn();
void setMapKeyColumn(JaxbMapKeyColumnImpl value); void setMapKeyColumn(JaxbMapKeyColumnImpl value);
List<JaxbMapKeyJoinColumnImpl> getMapKeyJoinColumn(); List<JaxbMapKeyJoinColumnImpl> getMapKeyJoinColumns();
JaxbForeignKeyImpl getMapKeyForeignKey(); JaxbForeignKeyImpl getMapKeyForeignKey();

View File

@ -60,8 +60,8 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbEmbeddedImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEmptyTypeImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEmptyTypeImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntity; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntity;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerContainerImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenersImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityOrMappedSuperclass; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityOrMappedSuperclass;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityResultImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityResultImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbFieldResultImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbFieldResultImpl;
@ -341,14 +341,12 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
this.xmlContext = xmlContext; this.xmlContext = xmlContext;
this.classLoaderAccess = classLoaderAccess; this.classLoaderAccess = classLoaderAccess;
if ( el instanceof Class ) { if ( el instanceof Class clazz ) {
Class clazz = (Class) el;
className = clazz.getName(); className = clazz.getName();
propertyName = null; propertyName = null;
propertyType = null; propertyType = null;
} }
else if ( el instanceof Field ) { else if ( el instanceof Field field ) {
Field field = (Field) el;
className = field.getDeclaringClass().getName(); className = field.getDeclaringClass().getName();
propertyName = field.getName(); propertyName = field.getName();
propertyType = PropertyType.FIELD; propertyType = PropertyType.FIELD;
@ -362,8 +360,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
//no method //no method
} }
} }
else if ( el instanceof Method ) { else if ( el instanceof Method method ) {
Method method = (Method) el;
className = method.getDeclaringClass().getName(); className = method.getDeclaringClass().getName();
String methodName = method.getName(); String methodName = method.getName();
@ -541,10 +538,10 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
for ( JaxbEmbeddedImpl element : elementsForProperty.getEmbedded() ) { for ( JaxbEmbeddedImpl element : elementsForProperty.getEmbedded() ) {
applyXmlDefinedConverts( element.getConvert(), defaults, propertyName, convertAnnotationsMap ); applyXmlDefinedConverts( element.getConverts(), defaults, propertyName, convertAnnotationsMap );
} }
for ( JaxbElementCollectionImpl element : elementsForProperty.getElementCollection() ) { for ( JaxbElementCollectionImpl element : elementsForProperty.getElementCollection() ) {
applyXmlDefinedConverts( element.getConvert(), defaults, propertyName, convertAnnotationsMap ); applyXmlDefinedConverts( element.getConverts(), defaults, propertyName, convertAnnotationsMap );
} }
// NOTE : per section 12.2.3.16 of the spec <convert/> is additive, although only if "metadata-complete" is not // NOTE : per section 12.2.3.16 of the spec <convert/> is additive, although only if "metadata-complete" is not
@ -832,11 +829,13 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
private EntityListeners getEntityListeners(JaxbManagedType root, XMLContext.Default defaults) { private EntityListeners getEntityListeners(JaxbManagedType root, XMLContext.Default defaults) {
JaxbEntityListenersImpl element = root instanceof JaxbEntityOrMappedSuperclass ? ( (JaxbEntityOrMappedSuperclass) root ).getEntityListeners() : null; JaxbEntityListenerContainerImpl container = root instanceof JaxbEntityOrMappedSuperclass
if ( element != null ) { ? ( (JaxbEntityOrMappedSuperclass) root ).getEntityListenerContainer()
: null;
if ( container != null ) {
final List<Class<?>> entityListenerClasses = new ArrayList<>(); final List<Class<?>> entityListenerClasses = new ArrayList<>();
for ( JaxbEntityListenerImpl subelement : element.getEntityListener() ) { for ( JaxbEntityListenerImpl entityListener : container.getEntityListeners() ) {
String className = subelement.getClazz(); String className = entityListener.getClazz();
try { try {
entityListenerClasses.add( entityListenerClasses.add(
classLoaderAccess.classForName( classLoaderAccess.classForName(
@ -1008,9 +1007,9 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
getOrderColumn( annotationList, element.getOrderColumn() ); getOrderColumn( annotationList, element.getOrderColumn() );
getMapKeyTemporal( annotationList, element.getMapKeyTemporal() ); getMapKeyTemporal( annotationList, element.getMapKeyTemporal() );
getMapKeyEnumerated( annotationList, element.getMapKeyEnumerated() ); getMapKeyEnumerated( annotationList, element.getMapKeyEnumerated() );
Annotation annotation = getMapKeyAttributeOverrides( element.getMapKeyAttributeOverride(), defaults ); Annotation annotation = getMapKeyAttributeOverrides( element.getMapKeyAttributeOverrides(), defaults );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
getMapKeyJoinColumns( annotationList, element.getMapKeyJoinColumn() ); getMapKeyJoinColumns( annotationList, element.getMapKeyJoinColumns() );
getAccessType( annotationList, element.getAccess() ); getAccessType( annotationList, element.getAccess() );
} }
afterGetAssociation( annotationType, annotationList, defaults ); afterGetAssociation( annotationType, annotationList, defaults );
@ -1062,7 +1061,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
getFetchType( ad, element.getFetch() ); getFetchType( ad, element.getFetch() );
getCascades( ad, element.getCascade(), defaults ); getCascades( ad, element.getCascade(), defaults );
getJoinTable( annotationList, element, defaults ); getJoinTable( annotationList, element, defaults );
buildJoinColumns( annotationList, element.getJoinColumn() ); buildJoinColumns( annotationList, element.getJoinColumns() );
copyAttribute( ad, "optional", element.isOptional(), false ); copyAttribute( ad, "optional", element.isOptional(), false );
annotationList.add( AnnotationFactory.create( ad ) ); annotationList.add( AnnotationFactory.create( ad ) );
@ -1096,9 +1095,9 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
getOrderColumn( annotationList, element.getOrderColumn() ); getOrderColumn( annotationList, element.getOrderColumn() );
getMapKeyTemporal( annotationList, element.getMapKeyTemporal() ); getMapKeyTemporal( annotationList, element.getMapKeyTemporal() );
getMapKeyEnumerated( annotationList, element.getMapKeyEnumerated() ); getMapKeyEnumerated( annotationList, element.getMapKeyEnumerated() );
Annotation annotation = getMapKeyAttributeOverrides( element.getMapKeyAttributeOverride(), defaults ); Annotation annotation = getMapKeyAttributeOverrides( element.getMapKeyAttributeOverrides(), defaults );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
getMapKeyJoinColumns( annotationList, element.getMapKeyJoinColumn() ); getMapKeyJoinColumns( annotationList, element.getMapKeyJoinColumns() );
getAccessType( annotationList, element.getAccess() ); getAccessType( annotationList, element.getAccess() );
} }
afterGetAssociation( annotationType, annotationList, defaults ); afterGetAssociation( annotationType, annotationList, defaults );
@ -1387,7 +1386,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
getMapKeyTemporal( annotationList, element.getMapKeyTemporal() ); getMapKeyTemporal( annotationList, element.getMapKeyTemporal() );
getMapKeyEnumerated( annotationList, element.getMapKeyEnumerated() ); getMapKeyEnumerated( annotationList, element.getMapKeyEnumerated() );
getMapKeyColumn( annotationList, element.getMapKeyColumn() ); getMapKeyColumn( annotationList, element.getMapKeyColumn() );
getMapKeyJoinColumns( annotationList, element.getMapKeyJoinColumn() ); getMapKeyJoinColumns( annotationList, element.getMapKeyJoinColumns() );
Annotation annotation = getColumn( element.getColumn(), false, "element-collection" ); Annotation annotation = getColumn( element.getColumn(), false, "element-collection" );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
getTemporal( annotationList, element.getTemporal() ); getTemporal( annotationList, element.getTemporal() );
@ -1397,11 +1396,11 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
//translate into AttributeOverride annotations, which need //translate into AttributeOverride annotations, which need
//need to be wrapped in the same AttributeOverrides annotation. //need to be wrapped in the same AttributeOverrides annotation.
List<AttributeOverride> attributes = new ArrayList<>(); List<AttributeOverride> attributes = new ArrayList<>();
attributes.addAll( buildAttributeOverrides( element.getMapKeyAttributeOverride(), "map-key-attribute-override" ) ); attributes.addAll( buildAttributeOverrides( element.getMapKeyAttributeOverrides(), "map-key-attribute-override" ) );
attributes.addAll( buildAttributeOverrides( element.getAttributeOverride(), "attribute-override" ) ); attributes.addAll( buildAttributeOverrides( element.getAttributeOverrides(), "attribute-override" ) );
annotation = mergeAttributeOverrides( defaults, attributes, false ); annotation = mergeAttributeOverrides( defaults, attributes, false );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
annotation = getAssociationOverrides( element.getAssociationOverride(), defaults, false ); annotation = getAssociationOverrides( element.getAssociationOverrides(), defaults, false );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
getCollectionTable( annotationList, element.getCollectionTable(), defaults ); getCollectionTable( annotationList, element.getCollectionTable(), defaults );
annotationList.add( AnnotationFactory.create( ad ) ); annotationList.add( AnnotationFactory.create( ad ) );
@ -1479,12 +1478,12 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
&& isEmpty( (String) annotation.valueOf( "schema" ) ) ) { && isEmpty( (String) annotation.valueOf( "schema" ) ) ) {
annotation.setValue( "schema", defaults.getSchema() ); annotation.setValue( "schema", defaults.getSchema() );
} }
JoinColumn[] joinColumns = getJoinColumns( element.getJoinColumn(), false ); JoinColumn[] joinColumns = getJoinColumns( element.getJoinColumns(), false );
if ( joinColumns.length > 0 ) { if ( joinColumns.length > 0 ) {
annotation.setValue( "joinColumns", joinColumns ); annotation.setValue( "joinColumns", joinColumns );
} }
buildUniqueConstraints( annotation, element.getUniqueConstraint() ); buildUniqueConstraints( annotation, element.getUniqueConstraints() );
buildIndex( annotation, element.getIndex() ); buildIndex( annotation, element.getIndexes() );
annotationList.add( AnnotationFactory.create( annotation ) ); annotationList.add( AnnotationFactory.create( annotation ) );
} }
} }
@ -1524,7 +1523,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
&& !cascades.contains( CascadeType.ALL ) && !cascades.contains( CascadeType.PERSIST ) ) { && !cascades.contains( CascadeType.ALL ) && !cascades.contains( CascadeType.PERSIST ) ) {
cascades.add( CascadeType.PERSIST ); cascades.add( CascadeType.PERSIST );
} }
if ( cascades.size() > 0 ) { if ( !cascades.isEmpty() ) {
ad.setValue( "cascade", cascades.toArray( new CascadeType[0] ) ); ad.setValue( "cascade", cascades.toArray( new CascadeType[0] ) );
} }
} }
@ -1533,9 +1532,9 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
for ( JaxbEmbeddedImpl element : elementsForProperty.getEmbedded() ) { for ( JaxbEmbeddedImpl element : elementsForProperty.getEmbedded() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( Embedded.class ); AnnotationDescriptor ad = new AnnotationDescriptor( Embedded.class );
annotationList.add( AnnotationFactory.create( ad ) ); annotationList.add( AnnotationFactory.create( ad ) );
Annotation annotation = getAttributeOverrides( element.getAttributeOverride(), defaults, false ); Annotation annotation = getAttributeOverrides( element.getAttributeOverrides(), defaults, false );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
annotation = getAssociationOverrides( element.getAssociationOverride(), defaults, false ); annotation = getAssociationOverrides( element.getAssociationOverrides(), defaults, false );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
getAccessType( annotationList, element.getAccess() ); getAccessType( annotationList, element.getAccess() );
} }
@ -1701,7 +1700,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
private void getEmbeddedId(List<Annotation> annotationList, XMLContext.Default defaults) { private void getEmbeddedId(List<Annotation> annotationList, XMLContext.Default defaults) {
for ( JaxbEmbeddedIdImpl element : elementsForProperty.getEmbeddedId() ) { for ( JaxbEmbeddedIdImpl element : elementsForProperty.getEmbeddedId() ) {
if ( isProcessingId( defaults ) ) { if ( isProcessingId( defaults ) ) {
Annotation annotation = getAttributeOverrides( element.getAttributeOverride(), defaults, false ); Annotation annotation = getAttributeOverrides( element.getAttributeOverrides(), defaults, false );
addIfNotNull( annotationList, annotation ); addIfNotNull( annotationList, annotation );
// TODO HHH-10176 We should allow association overrides here, but the JPA XSD doesn't allow that. We would need our own XSD. // TODO HHH-10176 We should allow association overrides here, but the JPA XSD doesn't allow that. We would need our own XSD.
AnnotationDescriptor ad = new AnnotationDescriptor( EmbeddedId.class ); AnnotationDescriptor ad = new AnnotationDescriptor( EmbeddedId.class );
@ -1833,7 +1832,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
for ( JaxbColumnImpl element : elements ) { for ( JaxbColumnImpl element : elements ) {
columns.add( getColumn( element, false, nodeName ) ); columns.add( getColumn( element, false, nodeName ) );
} }
if ( columns.size() > 0 ) { if ( !columns.isEmpty() ) {
AnnotationDescriptor columnsDescr = new AnnotationDescriptor( Columns.class ); AnnotationDescriptor columnsDescr = new AnnotationDescriptor( Columns.class );
columnsDescr.setValue( "columns", columns.toArray( new Column[ columns.size() ] ) ); columnsDescr.setValue( "columns", columns.toArray( new Column[ columns.size() ] ) );
return AnnotationFactory.create( columnsDescr ); return AnnotationFactory.create( columnsDescr );
@ -1910,7 +1909,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( attributes.size() > 0 ) { if ( !attributes.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( AssociationOverrides.class ); AnnotationDescriptor ad = new AnnotationDescriptor( AssociationOverrides.class );
ad.setValue( "value", attributes.toArray( new AssociationOverride[0] ) ); ad.setValue( "value", attributes.toArray( new AssociationOverride[0] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -1922,11 +1921,11 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
private List<AssociationOverride> buildAssociationOverrides(List<JaxbAssociationOverrideImpl> elements, XMLContext.Default defaults) { private List<AssociationOverride> buildAssociationOverrides(List<JaxbAssociationOverrideImpl> elements, XMLContext.Default defaults) {
List<AssociationOverride> overrides = new ArrayList<>(); List<AssociationOverride> overrides = new ArrayList<>();
if ( elements != null && elements.size() > 0 ) { if ( elements != null && !elements.isEmpty() ) {
for ( JaxbAssociationOverrideImpl current : elements ) { for ( JaxbAssociationOverrideImpl current : elements ) {
AnnotationDescriptor override = new AnnotationDescriptor( AssociationOverride.class ); AnnotationDescriptor override = new AnnotationDescriptor( AssociationOverride.class );
copyAttribute( override, "name", current.getName(), true ); copyAttribute( override, "name", current.getName(), true );
override.setValue( "joinColumns", getJoinColumns( current.getJoinColumn(), false ) ); override.setValue( "joinColumns", getJoinColumns( current.getJoinColumns(), false ) );
JoinTable joinTable = buildJoinTable( current.getJoinTable(), defaults ); JoinTable joinTable = buildJoinTable( current.getJoinTable(), defaults );
if ( joinTable != null ) { if ( joinTable != null ) {
override.setValue( "joinTable", joinTable ); override.setValue( "joinTable", joinTable );
@ -2010,7 +2009,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( attributes.size() > 0 ) { if ( !attributes.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( AttributeOverrides.class ); AnnotationDescriptor ad = new AnnotationDescriptor( AttributeOverrides.class );
ad.setValue( "value", attributes.toArray( new AttributeOverride[ attributes.size() ] ) ); ad.setValue( "value", attributes.toArray( new AttributeOverride[ attributes.size() ] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -2022,7 +2021,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
private List<AttributeOverride> buildAttributeOverrides(List<JaxbAttributeOverrideImpl> subelements, String nodeName) { private List<AttributeOverride> buildAttributeOverrides(List<JaxbAttributeOverrideImpl> subelements, String nodeName) {
List<AttributeOverride> overrides = new ArrayList<>(); List<AttributeOverride> overrides = new ArrayList<>();
if ( subelements != null && subelements.size() > 0 ) { if ( subelements != null && !subelements.isEmpty() ) {
for ( JaxbAttributeOverrideImpl current : subelements ) { for ( JaxbAttributeOverrideImpl current : subelements ) {
AnnotationDescriptor override = new AnnotationDescriptor( AttributeOverride.class ); AnnotationDescriptor override = new AnnotationDescriptor( AttributeOverride.class );
copyAttribute( override, "name", current.getName(), true ); copyAttribute( override, "name", current.getName(), true );
@ -2143,7 +2142,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( results.size() > 0 ) { if ( !results.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( SqlResultSetMappings.class ); AnnotationDescriptor ad = new AnnotationDescriptor( SqlResultSetMappings.class );
ad.setValue( "value", results.toArray( new SqlResultSetMapping[ results.size() ] ) ); ad.setValue( "value", results.toArray( new SqlResultSetMapping[ results.size() ] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -2407,7 +2406,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
constructorResultDescriptor.setValue( "targetClass", entityClass ); constructorResultDescriptor.setValue( "targetClass", entityClass );
List<ColumnResult> columnResultAnnotations = new ArrayList<>(); List<ColumnResult> columnResultAnnotations = new ArrayList<>();
for ( JaxbColumnResultImpl columnResultElement : constructorResultElement.getColumn() ) { for ( JaxbColumnResultImpl columnResultElement : constructorResultElement.getColumns() ) {
columnResultAnnotations.add( buildColumnResult( columnResultElement, defaults, classLoaderAccess ) ); columnResultAnnotations.add( buildColumnResult( columnResultElement, defaults, classLoaderAccess ) );
} }
constructorResultDescriptor.setValue( constructorResultDescriptor.setValue(
@ -2449,7 +2448,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( queries.size() > 0 ) { if ( !queries.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( NamedQueries.class ); AnnotationDescriptor ad = new AnnotationDescriptor( NamedQueries.class );
ad.setValue( "value", queries.toArray( new NamedQuery[queries.size()] ) ); ad.setValue( "value", queries.toArray( new NamedQuery[queries.size()] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -2489,7 +2488,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( queries.size() > 0 ) { if ( !queries.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( NamedEntityGraphs.class ); AnnotationDescriptor ad = new AnnotationDescriptor( NamedEntityGraphs.class );
ad.setValue( "value", queries.toArray( new NamedEntityGraph[queries.size()] ) ); ad.setValue( "value", queries.toArray( new NamedEntityGraph[queries.size()] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -2530,7 +2529,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( queries.size() > 0 ) { if ( !queries.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( NamedStoredProcedureQueries.class ); AnnotationDescriptor ad = new AnnotationDescriptor( NamedStoredProcedureQueries.class );
ad.setValue( "value", queries.toArray( new NamedStoredProcedureQuery[queries.size()] ) ); ad.setValue( "value", queries.toArray( new NamedStoredProcedureQuery[queries.size()] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -2573,7 +2572,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( queries.size() > 0 ) { if ( !queries.isEmpty() ) {
AnnotationDescriptor ad = new AnnotationDescriptor( NamedNativeQueries.class ); AnnotationDescriptor ad = new AnnotationDescriptor( NamedNativeQueries.class );
ad.setValue( "value", queries.toArray( new NamedNativeQuery[queries.size()] ) ); ad.setValue( "value", queries.toArray( new NamedNativeQuery[queries.size()] ) );
return AnnotationFactory.create( ad ); return AnnotationFactory.create( ad );
@ -2715,7 +2714,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
private TableGenerator getTableGenerator(JaxbManagedType root, XMLContext.Default defaults) { private TableGenerator getTableGenerator(JaxbManagedType root, XMLContext.Default defaults) {
return getTableGenerator( return getTableGenerator(
root instanceof JaxbEntityImpl ? ( (JaxbEntityImpl) root ).getTableGenerator() : null, root instanceof JaxbEntityImpl ? ( (JaxbEntityImpl) root ).getTableGenerators() : null,
defaults defaults
); );
} }
@ -2783,7 +2782,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
private SequenceGenerator getSequenceGenerator(JaxbManagedType root, XMLContext.Default defaults) { private SequenceGenerator getSequenceGenerator(JaxbManagedType root, XMLContext.Default defaults) {
return getSequenceGenerator( return getSequenceGenerator(
root instanceof JaxbEntityImpl ? ( (JaxbEntityImpl) root ).getSequenceGenerator() : null, root instanceof JaxbEntityImpl ? ( (JaxbEntityImpl) root ).getSequenceGenerators() : null,
defaults defaults
); );
} }
@ -2944,8 +2943,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
return defaults.canUseJavaAnnotations() ? getPhysicalAnnotation( Entity.class ) : null; return defaults.canUseJavaAnnotations() ? getPhysicalAnnotation( Entity.class ) : null;
} }
else { else {
if ( element instanceof JaxbEntityImpl ) { if ( element instanceof JaxbEntityImpl entityElement ) {
JaxbEntityImpl entityElement = (JaxbEntityImpl) element;
AnnotationDescriptor entity = new AnnotationDescriptor( Entity.class ); AnnotationDescriptor entity = new AnnotationDescriptor( Entity.class );
copyAttribute( entity, "name", entityElement.getName(), false ); copyAttribute( entity, "name", entityElement.getName(), false );
if ( defaults.canUseJavaAnnotations() if ( defaults.canUseJavaAnnotations()
@ -3087,7 +3085,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
* You can't have both secondary tables in XML and Java, * You can't have both secondary tables in XML and Java,
* since there would be no way to "remove" a secondary table * since there would be no way to "remove" a secondary table
*/ */
if ( secondaryTables.size() == 0 && defaults.canUseJavaAnnotations() ) { if ( secondaryTables.isEmpty() && defaults.canUseJavaAnnotations() ) {
SecondaryTable secTableAnn = getPhysicalAnnotation( SecondaryTable.class ); SecondaryTable secTableAnn = getPhysicalAnnotation( SecondaryTable.class );
overridesDefaultInSecondaryTable( secTableAnn, defaults, secondaryTables ); overridesDefaultInSecondaryTable( secTableAnn, defaults, secondaryTables );
SecondaryTables secTablesAnn = getPhysicalAnnotation( SecondaryTables.class ); SecondaryTables secTablesAnn = getPhysicalAnnotation( SecondaryTables.class );
@ -3097,7 +3095,7 @@ public class JPAXMLOverriddenAnnotationReader implements AnnotationReader {
} }
} }
} }
if ( secondaryTables.size() > 0 ) { if ( !secondaryTables.isEmpty() ) {
AnnotationDescriptor descriptor = new AnnotationDescriptor( SecondaryTables.class ); AnnotationDescriptor descriptor = new AnnotationDescriptor( SecondaryTables.class );
descriptor.setValue( "value", secondaryTables.toArray( new SecondaryTable[secondaryTables.size()] ) ); descriptor.setValue( "value", secondaryTables.toArray( new SecondaryTable[secondaryTables.size()] ) );
return AnnotationFactory.create( descriptor ); return AnnotationFactory.create( descriptor );

View File

@ -16,8 +16,8 @@ import org.hibernate.AnnotationException;
import org.hibernate.boot.internal.ClassmateContext; import org.hibernate.boot.internal.ClassmateContext;
import org.hibernate.boot.jaxb.mapping.spi.JaxbConverterImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbConverterImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerContainerImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenersImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
import org.hibernate.boot.jaxb.mapping.spi.JaxbManagedType; import org.hibernate.boot.jaxb.mapping.spi.JaxbManagedType;
import org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclassImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclassImpl;
@ -91,7 +91,7 @@ public class XMLContext implements Serializable {
globalDefaults.setAccess( defaultElement.getAccess() ); globalDefaults.setAccess( defaultElement.getAccess() );
globalDefaults.setCascadePersist( defaultElement.getCascadePersist() != null ? Boolean.TRUE : null ); globalDefaults.setCascadePersist( defaultElement.getCascadePersist() != null ? Boolean.TRUE : null );
globalDefaults.setDelimitedIdentifiers( defaultElement.getDelimitedIdentifiers() != null ? Boolean.TRUE : null ); globalDefaults.setDelimitedIdentifiers( defaultElement.getDelimitedIdentifiers() != null ? Boolean.TRUE : null );
defaultEntityListeners.addAll( addEntityListenerClasses( defaultElement.getEntityListeners(), null, addedClasses ) ); defaultEntityListeners.addAll( addEntityListenerClasses( defaultElement.getEntityListenerContainer(), null, addedClasses ) );
} }
} }
else { else {
@ -141,18 +141,18 @@ public class XMLContext implements Serializable {
LOG.debugf( "Adding XML overriding information for %s", className ); LOG.debugf( "Adding XML overriding information for %s", className );
if ( element instanceof JaxbEntityImpl ) { if ( element instanceof JaxbEntityImpl ) {
addEntityListenerClasses( ( (JaxbEntityImpl) element ).getEntityListeners(), packageName, addedClasses ); addEntityListenerClasses( ( (JaxbEntityImpl) element ).getEntityListenerContainer(), packageName, addedClasses );
} }
else if ( element instanceof JaxbMappedSuperclassImpl ) { else if ( element instanceof JaxbMappedSuperclassImpl ) {
addEntityListenerClasses( ( (JaxbMappedSuperclassImpl) element ).getEntityListeners(), packageName, addedClasses ); addEntityListenerClasses( ( (JaxbMappedSuperclassImpl) element ).getEntityListenerContainer(), packageName, addedClasses );
} }
} }
} }
private List<String> addEntityListenerClasses(JaxbEntityListenersImpl listeners, String packageName, List<String> addedClasses) { private List<String> addEntityListenerClasses(JaxbEntityListenerContainerImpl listeners, String packageName, List<String> addedClasses) {
List<String> localAddedClasses = new ArrayList<>(); List<String> localAddedClasses = new ArrayList<>();
if ( listeners != null ) { if ( listeners != null ) {
List<JaxbEntityListenerImpl> elements = listeners.getEntityListener(); List<JaxbEntityListenerImpl> elements = listeners.getEntityListeners();
for ( JaxbEntityListenerImpl listener : elements ) { for ( JaxbEntityListenerImpl listener : elements ) {
String listenerClassName = buildSafeClassName( listener.getClazz(), packageName ); String listenerClassName = buildSafeClassName( listener.getClazz(), packageName );
if ( entityListenerOverride.containsKey( listenerClassName ) ) { if ( entityListenerOverride.containsKey( listenerClassName ) ) {

View File

@ -88,6 +88,12 @@
</bindings> </bindings>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='persistence-unit-defaults']">
<bindings node=".//xsd:element[@name='entity-listeners']">
<property name="entityListenerContainer"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='collection-user-type-registration']"> <bindings node="//xsd:complexType[@name='collection-user-type-registration']">
<bindings node=".//xsd:element[@name='param']"> <bindings node=".//xsd:element[@name='param']">
<property name="parameters"/> <property name="parameters"/>
@ -97,6 +103,22 @@
<bindings node="//xsd:complexType[@name='entity']"> <bindings node="//xsd:complexType[@name='entity']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbEntity</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbEntity</inheritance:implements>
<bindings node=".//xsd:element[@name='entity-listeners']">
<property name="entityListenerContainer"/>
</bindings>
<bindings node=".//xsd:element[@name='sequence-generator']">
<property name="sequenceGenerators"/>
</bindings>
<bindings node=".//xsd:element[@name='table-generator']">
<property name="tableGenerators"/>
</bindings>
<bindings node=".//xsd:element[@name='identifier-generator']">
<property name="identifierGenerators"/>
</bindings>
<bindings node=".//xsd:element[@name='primary-key-join-column']"> <bindings node=".//xsd:element[@name='primary-key-join-column']">
<property name="primaryKeyJoinColumns"/> <property name="primaryKeyJoinColumns"/>
</bindings> </bindings>
@ -150,12 +172,24 @@
</bindings> </bindings>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='association-override']">
<bindings node=".//xsd:element[@name='join-column']">
<property name="joinColumns"/>
</bindings>
<bindings node=".//xsd:element[@name='foreign-key']">
<property name="foreignKeys"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='embeddable']"> <bindings node="//xsd:complexType[@name='embeddable']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbEmbeddable</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbEmbeddable</inheritance:implements>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='mapped-superclass']"> <bindings node="//xsd:complexType[@name='mapped-superclass']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclass</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclass</inheritance:implements>
<bindings node=".//xsd:element[@name='entity-listeners']">
<property name="entityListenerContainer"/>
</bindings>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='attributes']"> <bindings node="//xsd:complexType[@name='attributes']">
@ -276,6 +310,21 @@
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbNotFoundCapable</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbNotFoundCapable</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbAssociationAttribute</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbAssociationAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbJoinTableCapable</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbJoinTableCapable</inheritance:implements>
<bindings node=".//xsd:element[@name='join-column']">
<property name="joinColumns"/>
</bindings>
<bindings node=".//xsd:element[@name='foreign-key']">
<property name="foreignKeys"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='join-column']">
<bindings node=".//xsd:element[@name='foreign-key']">
<property name="foreignKeys"/>
</bindings>
<bindings node=".//xsd:element[@name='check-constraint']">
<property name="checkConstraints"/>
</bindings>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='hbm-any-mapping']"> <bindings node="//xsd:complexType[@name='hbm-any-mapping']">
@ -395,11 +444,79 @@
</bindings> </bindings>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='constructor-result']">
<bindings node=".//xsd:element[@name='column']">
<property name="columns"/>
</bindings>
</bindings>
<bindings node="//xsd:group[@name='collection-structure-group']">
<bindings node=".//xsd:element[@name='map-key-attribute-override']">
<property name="mapKeyAttributeOverrides"/>
</bindings>
<bindings node=".//xsd:element[@name='map-key-convert']">
<property name="mapKeyConverts"/>
</bindings>
<bindings node=".//xsd:element[@name='map-key-join-column']">
<property name="mapKeyJoinColumns"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='element-collection']">
<bindings node=".//xsd:element[@name='attribute-override']">
<property name="attributeOverrides"/>
</bindings>
<bindings node=".//xsd:element[@name='association-override']">
<property name="associationOverrides"/>
</bindings>
<bindings node=".//xsd:element[@name='convert']">
<property name="converts"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='embedded']">
<bindings node=".//xsd:element[@name='attribute-override']">
<property name="attributeOverrides"/>
</bindings>
<bindings node=".//xsd:element[@name='association-override']">
<property name="associationOverrides"/>
</bindings>
<bindings node=".//xsd:element[@name='convert']">
<property name="converts"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='embedded-id']">
<bindings node=".//xsd:element[@name='attribute-override']">
<property name="attributeOverrides"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='entity-listeners']">
<class name="JaxbEntityListenerContainerImpl"/>
<bindings node=".//xsd:element[@name='entity-listener']">
<property name="entityListeners"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='join-table']"> <bindings node="//xsd:complexType[@name='join-table']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='collection-table']"> <bindings node="//xsd:complexType[@name='collection-table']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements>
<bindings node=".//xsd:element[@name='join-column']">
<property name="joinColumns"/>
</bindings>
<bindings node=".//xsd:element[@name='foreign-key']">
<property name="foreignKeys"/>
</bindings>
<bindings node=".//xsd:element[@name='unique-constraint']">
<property name="uniqueConstraints"/>
</bindings>
<bindings node=".//xsd:element[@name='index']">
<property name="indexes"/>
</bindings>
</bindings> </bindings>
<bindings node="//xsd:complexType[@name='table-generator']"> <bindings node="//xsd:complexType[@name='table-generator']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements> <inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements>
@ -610,6 +727,12 @@
printMethod="org.hibernate.boot.jaxb.mapping.internal.LimitedCollectionClassificationMarshalling.toXml" /> printMethod="org.hibernate.boot.jaxb.mapping.internal.LimitedCollectionClassificationMarshalling.toXml" />
</bindings> </bindings>
<bindings node="//xsd:simpleType[@name='not-found-enum']">
<javaType name="org.hibernate.annotations.NotFoundAction"
parseMethod="org.hibernate.boot.jaxb.mapping.internal.NotFoundActionMarshalling.fromXml"
printMethod="org.hibernate.boot.jaxb.mapping.internal.NotFoundActionMarshalling.toXml" />
</bindings>
<bindings node="//xsd:simpleType[@name='uuid-generator-style']"> <bindings node="//xsd:simpleType[@name='uuid-generator-style']">
<javaType name="org.hibernate.annotations.UuidGenerator.Style" <javaType name="org.hibernate.annotations.UuidGenerator.Style"
parseMethod="org.hibernate.boot.jaxb.mapping.internal.UuidGeneratorStyleMarshalling.fromXml" parseMethod="org.hibernate.boot.jaxb.mapping.internal.UuidGeneratorStyleMarshalling.fromXml"

View File

@ -52,8 +52,8 @@ public class JakartaXmlSmokeTests {
final JaxbPersistenceUnitMetadataImpl puMetadata = binding.getRoot().getPersistenceUnitMetadata(); final JaxbPersistenceUnitMetadataImpl puMetadata = binding.getRoot().getPersistenceUnitMetadata();
final JaxbPersistenceUnitDefaultsImpl puDefaults = puMetadata.getPersistenceUnitDefaults(); final JaxbPersistenceUnitDefaultsImpl puDefaults = puMetadata.getPersistenceUnitDefaults();
final Stream<String> listenerNames = puDefaults.getEntityListeners() final Stream<String> listenerNames = puDefaults.getEntityListenerContainer()
.getEntityListener() .getEntityListeners()
.stream() .stream()
.map( JaxbEntityListenerImpl::getClazz ); .map( JaxbEntityListenerImpl::getClazz );
assertThat( listenerNames ).containsOnly( "org.hibernate.jpa.test.pack.defaultpar.IncrementListener" ); assertThat( listenerNames ).containsOnly( "org.hibernate.jpa.test.pack.defaultpar.IncrementListener" );