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-18 08:06:54 -06:00
parent 0a667f66c8
commit 92d817bb27
20 changed files with 329 additions and 32 deletions

View File

@ -67,4 +67,14 @@ public interface JaxbPluralAttribute extends JaxbPersistentAttribute, JaxbLockab
void setMapKeyForeignKey(JaxbForeignKeyImpl value);
List<JaxbHbmFilterImpl> getFilters();
@Override
default Boolean isOptional() {
return null;
}
@Override
default void setOptional(Boolean optional) {
}
}

View File

@ -17,4 +17,7 @@ import jakarta.persistence.FetchType;
public interface JaxbStandardAttribute extends JaxbPersistentAttribute {
FetchType getFetch();
void setFetch(FetchType value);
Boolean isOptional();
void setOptional(Boolean optional);
}

View File

@ -1,15 +0,0 @@
/*
* 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.spi;
/**
* @author Steve Ebersole
*/
public interface JaxbTableMapping extends JaxbSchemaAware {
String getComment();
String getOptions();
}

View File

@ -2,9 +2,9 @@
* 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>.
* 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.spi;
package org.hibernate.boot.jaxb.mapping.spi.db;
/**
* @author Steve Ebersole

View File

@ -0,0 +1,19 @@
/*
* 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.spi.db;
import java.util.List;
import org.hibernate.boot.jaxb.mapping.spi.JaxbCheckConstraintImpl;
/**
* @author Steve Ebersole
*/
public interface JaxbCheckable {
List<JaxbCheckConstraintImpl> getCheckConstraints();
}

View File

@ -0,0 +1,20 @@
/*
* 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.spi.db;
/**
* Base definition for XSD column mappings
*
* @author Steve Ebersole
*/
public interface JaxbColumn extends JaxbDatabaseObject {
String getName();
default String getTable() {
return null;
}
}

View File

@ -0,0 +1,55 @@
/*
* 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.spi.db;
import java.util.Collections;
import java.util.List;
import org.hibernate.boot.jaxb.mapping.spi.JaxbCheckConstraintImpl;
/**
* Composition of the aspects of column definition most commonly exposed in XSD "column types"
*
* @author Steve Ebersole
*/
public interface JaxbColumnCommon
extends JaxbColumn, JaxbColumnMutable, JaxbCheckable, JaxbColumnNullable, JaxbColumnUniqueable, JaxbColumnDefinable, JaxbCommentable {
@Override
default String getTable() {
return null;
}
@Override
default Boolean isNullable() {
return null;
}
@Override
default Boolean isInsertable() {
return null;
}
@Override
default Boolean isUpdatable() {
return null;
}
@Override
default String getComment() {
return null;
}
@Override
default Boolean isUnique() {
return null;
}
@Override
default List<JaxbCheckConstraintImpl> getCheckConstraints() {
return Collections.emptyList();
}
}

View File

@ -0,0 +1,14 @@
/*
* 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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbColumnDefaultable extends JaxbColumn {
String getDefault();
}

View File

@ -0,0 +1,15 @@
/*
* 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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbColumnDefinable extends JaxbColumn {
String getColumnDefinition();
String getOptions();
}

View File

@ -0,0 +1,19 @@
/*
* 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.spi.db;
import org.hibernate.boot.jaxb.mapping.spi.JaxbForeignKeyImpl;
/**
* Composition of the aspects of column definition for join "column types" exposed in XSD
*
* @author Steve Ebersole
*/
public interface JaxbColumnJoined extends JaxbColumnCommon {
String getReferencedColumnName();
JaxbForeignKeyImpl getForeignKey();
}

View File

@ -0,0 +1,15 @@
/*
* 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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbColumnMutable extends JaxbColumn {
Boolean isInsertable();
Boolean isUpdatable();
}

View File

@ -0,0 +1,15 @@
/*
* 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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbColumnNullable extends JaxbColumn {
Boolean isNullable();
}

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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbColumnSizable extends JaxbColumn {
Integer getLength();
default Integer getPrecision() {
return null;
}
default Integer getScale() {
return null;
}
}

View File

@ -0,0 +1,20 @@
/*
* 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.spi.db;
/**
* Composition of the aspects of column definition for standard "column types" exposed in XSD
*
* @author Steve Ebersole
*/
public interface JaxbColumnStandard
extends JaxbColumn, JaxbColumnMutable, JaxbCheckable, JaxbColumnNullable, JaxbColumnUniqueable,
JaxbColumnDefinable, JaxbColumnSizable, JaxbColumnDefaultable, JaxbCommentable {
String getRead();
String getWrite();
}

View File

@ -0,0 +1,14 @@
/*
* 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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbColumnUniqueable extends JaxbColumn {
Boolean isUnique();
}

View File

@ -0,0 +1,14 @@
/*
* 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.spi.db;
/**
* @author Steve Ebersole
*/
public interface JaxbCommentable {
String getComment();
}

View File

@ -0,0 +1,15 @@
/*
* 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.spi.db;
/**
* Marker interface for database objects
*
* @author Steve Ebersole
*/
public interface JaxbDatabaseObject {
}

View File

@ -0,0 +1,19 @@
/*
* 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.spi.db;
import org.hibernate.boot.jaxb.mapping.spi.JaxbSchemaAware;
import org.hibernate.boot.jaxb.mapping.spi.db.JaxbCheckable;
import org.hibernate.boot.jaxb.mapping.spi.db.JaxbDatabaseObject;
/**
* @author Steve Ebersole
*/
public interface JaxbTableMapping extends JaxbSchemaAware, JaxbCheckable, JaxbDatabaseObject {
String getComment();
String getOptions();
}

View File

@ -3086,6 +3086,7 @@
<xsd:attribute name="attribute-accessor" type="xsd:string" />
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="fetch-mode" type="orm:singular-fetch-mode"/>
<xsd:attribute name="optional" type="xsd:boolean"/>
<xsd:attribute name="optimistic-lock" type="xsd:boolean" default="true" />
</xsd:complexType>
@ -3097,7 +3098,7 @@
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="type" type="xsd:string" minOccurs="0"/>
<xsd:element name="type" type="orm:discriminator-type" minOccurs="0"/>
<xsd:element name="column" type="orm:column" minOccurs="0"/>
<xsd:element name="mapping" type="orm:any-discriminator-value-mapping" maxOccurs="unbounded" />
</xsd:sequence>

View File

@ -318,15 +318,6 @@
</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 node="//xsd:complexType[@name='hbm-any-mapping']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbSingularAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbStandardAttribute</inheritance:implements>
@ -430,12 +421,13 @@
<property name="caching"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='table']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbTableMapping</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbTableMapping</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='check-constraint']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbCheckConstraint</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbCheckConstraint</inheritance:implements>
</bindings>
<bindings node="//xsd:group[@name='hbm-common-table-extensions']">
@ -500,11 +492,11 @@
</bindings>
<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.db.JaxbTableMapping</inheritance:implements>
</bindings>
<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.db.JaxbTableMapping</inheritance:implements>
<bindings node=".//xsd:element[@name='join-column']">
<property name="joinColumns"/>
</bindings>
@ -519,7 +511,7 @@
</bindings>
</bindings>
<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.db.JaxbTableMapping</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='sequence-generator']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbSchemaAware</inheritance:implements>
@ -536,11 +528,41 @@
</bindings>
<bindings node="//xsd:complexType[@name='column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnStandard</inheritance:implements>
<bindings node=".//xsd:element[@name='check-constraint']">
<property name="checkConstraints"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='join-column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnJoined</inheritance:implements>
<bindings node=".//xsd:element[@name='check-constraint']">
<property name="checkConstraints"/>
</bindings>
</bindings>
<bindings node="//xsd:complexType[@name='primary-key-join-column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnJoined</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='order-column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumn</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='discriminator-column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnCommon</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnSizable</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='map-key-column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnCommon</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnSizable</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='map-key-join-column']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.db.JaxbColumnJoined</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='entity-listener']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.JaxbLifecycleCallbackContainer</inheritance:implements>
</bindings>