Skip to content

Commit

Permalink
HHH-17377 - Migrate to JPA 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Nov 17, 2023
1 parent 0b755ea commit ab4b401
Show file tree
Hide file tree
Showing 93 changed files with 5,329 additions and 1,233 deletions.
2 changes: 1 addition & 1 deletion hibernate-core/hibernate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ xjc {
xjcExtensions += ['inheritance', 'simplify']
}
mapping {
xsdFile = file( 'src/main/resources/org/hibernate/xsd/mapping/mapping-3.1.0.xsd' )
xsdFile = file( 'src/main/resources/org/hibernate/xsd/mapping/mapping-3.2.0.xsd' )
xjcBindingFile = file( 'src/main/xjb/mapping-bindings.xjb' )
xjcExtensions += ['inheritance', 'simplify']
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.hibernate.boot.archive.spi.InputStreamAccess;
import org.hibernate.boot.internal.MetadataBuilderImpl;
import org.hibernate.boot.jaxb.internal.XmlSources;
import org.hibernate.boot.jaxb.spi.BindableMappingDescriptor;
import org.hibernate.boot.jaxb.spi.JaxbBindableMappingDescriptor;
import org.hibernate.boot.jaxb.spi.Binding;
import org.hibernate.boot.jaxb.spi.XmlSource;
import org.hibernate.boot.registry.BootstrapServiceRegistry;
Expand Down Expand Up @@ -65,7 +65,7 @@ public class MetadataSources implements Serializable {

private XmlMappingBinderAccess xmlMappingBinderAccess;

private List<Binding<BindableMappingDescriptor>> xmlBindings;
private List<Binding<JaxbBindableMappingDescriptor>> xmlBindings;
private LinkedHashSet<Class<?>> annotatedClasses;
private LinkedHashSet<String> annotatedClassNames;
private LinkedHashSet<String> annotatedPackages;
Expand Down Expand Up @@ -121,7 +121,7 @@ public XmlMappingBinderAccess getXmlMappingBinderAccess() {
return xmlMappingBinderAccess;
}

public List<Binding<BindableMappingDescriptor>> getXmlBindings() {
public List<Binding<JaxbBindableMappingDescriptor>> getXmlBindings() {
return xmlBindings == null ? Collections.emptyList() : xmlBindings;
}

Expand Down Expand Up @@ -373,7 +373,7 @@ public MetadataSources addFile(File file) {
*/
public MetadataSources addXmlBinding(Binding<?> binding) {
//noinspection unchecked
getXmlBindingsForWrite().add( (Binding<BindableMappingDescriptor>) binding );
getXmlBindingsForWrite().add( (Binding<JaxbBindableMappingDescriptor>) binding );
return this;
}

Expand Down Expand Up @@ -549,7 +549,7 @@ public MetadataSources addJar(File jar) {
return this;
}

private List<Binding<BindableMappingDescriptor>> getXmlBindingsForWrite() {
private List<Binding<JaxbBindableMappingDescriptor>> getXmlBindingsForWrite() {
if ( xmlBindings == null ) {
xmlBindings = new ArrayList<>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.internal;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Used in mapping dynamic models to signify that an entity should be considered abstract.
*
* @author Steve Ebersole
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Abstract {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.internal;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Used in mapping dynamic models to signify the type of collection to use for a plural attribute
*
* @author Steve Ebersole
*/
@Target({ElementType.FIELD,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface CollectionClassification {
LimitedCollectionClassification value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.internal;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Used in mapping dynamic models to specify from which other entity an entity extends.
*
* @author Steve Ebersole
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Extends {
/**
* The type extended. String because dynamic models have named "classes".
*/
String superType();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.internal;

/**
* Limited set of {@linkplain org.hibernate.metamodel.CollectionClassification}
* used in mapping a dynamic model.
*
* @see org.hibernate.boot.jaxb.mapping.spi.JaxbCollectionClassificationImpl
* @see org.hibernate.metamodel.CollectionClassification
*
* @author Steve Ebersole
*/
public enum LimitedCollectionClassification {
BAG,
LIST,
SET,
MAP
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.internal;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* Used in mapping dynamic models to specify the java-type of an attribute, mainly for
* {@linkplain jakarta.persistence.Basic basic},
* {@linkplain jakarta.persistence.Id id},
* {@linkplain jakarta.persistence.Embedded embedded} and
* {@linkplain jakarta.persistence.EmbeddedId embedded-id} attributes.
* Can also be useful for {@linkplain org.hibernate.annotations.Any any} and
* {@linkplain org.hibernate.annotations.ManyToAny many-to-any} attributes to
* specify a base type.
* <p/>
* Other attribute classifications have spec-defined ways to specify the target<ul>
* <li>{@linkplain jakarta.persistence.ManyToOne#targetEntity()}</li>
* <li>{@linkplain jakarta.persistence.OneToOne#targetEntity()}</li>
* <li>{@linkplain jakarta.persistence.ElementCollection#targetClass()} </li>
* <li>{@linkplain jakarta.persistence.OneToMany#targetEntity()}</li>
* <li>{@linkplain jakarta.persistence.ManyToMany#targetEntity()}</li>
* </ul>
*
* @author Steve Ebersole
*/
@java.lang.annotation.Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Target {
/**
* The attribute's Java type
*/
String value();
}

0 comments on commit ab4b401

Please sign in to comment.