Merge remote-tracking branch 'upstream/master' into wip/6.0_merge_35

This commit is contained in:
Andrea Boriero 2020-04-20 13:44:39 +01:00
commit 88d65adafb
43 changed files with 177 additions and 98 deletions

View File

@ -385,8 +385,8 @@ Unless specified, the JDBC Driver uses the default JVM time zone. If a different
This setting applies to Oracle Dialect only, and it specifies whether `byte[]` or `Byte[]` arrays should be mapped to the deprecated `LONG RAW` (when this configuration property value is `true`) or to a `BLOB` column type (when this configuration property value is `false`).
==== Bean Validation options
`*javax.persistence.validation.factory*` (e.g. `javax.validation.ValidationFactory` implementation)::
Specify the `javax.validation.ValidationFactory` implementation to use for Bean Validation.
`*javax.persistence.validation.factory*` (e.g. `jakarta.validation.ValidationFactory` implementation)::
Specify the `jakarta.validation.ValidationFactory` implementation to use for Bean Validation.
`*hibernate.check_nullability*` (e.g. `true` or `false`)::
Enable nullability checking. Raises an exception if a property marked as not-null is null.

View File

@ -18,9 +18,9 @@ ext {
jnpVersion = '5.0.6.CR1'
hibernateCommonsVersion = '5.1.0.Final'
hibernateValidatorVersion = '6.0.13.Final'
validationApiVersion = '2.0.1.Final'
elVersion = '3.0.1-b09'
hibernateValidatorVersion = '7.0.0.Alpha1' // Preview of Jakarta EE 9 (Validation 3.0)
validationApiVersion = '3.0.0-M1' // Preview of Jakarta EE 9 (Validation 3.0)
elVersion = '4.0.0-RC1' // Preview of Jakarta EE 9 : dependency of Validation 3.0
cdiVersion = '2.0'
weldVersion = '3.0.0.Final'
@ -76,7 +76,7 @@ ext {
// javax
jpa: "javax.persistence:javax.persistence-api:${project.jpaVersion}",
jta: 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.1.1.Final',
validation: "javax.validation:validation-api:${validationApiVersion}",
validation: "jakarta.validation:jakarta.validation-api:${validationApiVersion}",
jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.2.Final',
interceptor: 'javax.interceptor:javax.interceptor-api:1.2',
// required by JAXB from JDK 9 as it is not available anymore in JDK 9
@ -145,7 +145,7 @@ ext {
validator: "org.hibernate.validator:hibernate-validator:${hibernateValidatorVersion}",
// EL required by Hibernate Validator at test runtime
expression_language: "org.glassfish:javax.el:${elVersion}",
expression_language: "org.glassfish:jakarta.el:${elVersion}",
c3p0: "com.mchange:c3p0:0.9.5.3",
ehcache: "net.sf.ehcache:ehcache:2.10.6",

View File

@ -143,12 +143,12 @@ jar {
'javax.security.auth;resolution:=optional',
// Make javax.security.jacc optional and do not reference a version range (because that's what we used to do)
'javax.security.jacc;resolution:=optional;version=!',
// Make javax.validation optional and do not reference a version range (because that's what we used to do)
'javax.validation;resolution:=optional;version=!',
'javax.validation.constraints;resolution:=optional;version=!',
'javax.validation.groups;resolution:=optional;version=!',
'javax.validation.metadata;resolution:=optional;version=!',
// Make javax.enterprise optional and do not reference a version range (because that's what we used to do)
// Make jakarta.validation optional and do not reference a version range (because that's what we used to do)
'jakarta.validation;resolution:=optional;version=!',
'jakarta.validation.constraints;resolution:=optional;version=!',
'jakarta.validation.groups;resolution:=optional;version=!',
'jakarta.validation.metadata;resolution:=optional;version=!',
// Make javax.enterprise optional and do not reference a version range (because that's what we used to do)
'!javax.enterprise*',
'javax.enterprise.context.spi;resolution:=optional;version=!',
'javax.enterprise.inject.spi;resolution:=optional;version=!',

View File

@ -10,12 +10,12 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.TraversableResolver;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.TraversableResolver;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
import org.hibernate.EntityMode;
import org.hibernate.boot.internal.ClassLoaderAccessImpl;

View File

@ -32,7 +32,7 @@ public class BeanValidationIntegrator implements Integrator {
public static final String APPLY_CONSTRAINTS = "hibernate.validator.apply_to_ddl";
public static final String BV_CHECK_CLASS = "javax.validation.Validation";
public static final String BV_CHECK_CLASS = "jakarta.validation.Validation";
public static final String MODE_PROPERTY = "javax.persistence.validation.mode";

View File

@ -10,7 +10,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.validation.groups.Default;
import jakarta.validation.groups.Default;
import org.hibernate.HibernateException;
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;

View File

@ -9,8 +9,8 @@ import java.lang.annotation.ElementType;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.validation.Path;
import javax.validation.TraversableResolver;
import jakarta.validation.Path;
import jakarta.validation.TraversableResolver;
import org.hibernate.Hibernate;
import org.hibernate.annotations.common.AssertionFailure;

View File

@ -15,16 +15,16 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.metadata.BeanDescriptor;
import javax.validation.metadata.ConstraintDescriptor;
import javax.validation.metadata.PropertyDescriptor;
import jakarta.validation.Validation;
import jakarta.validation.ValidatorFactory;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.validation.metadata.BeanDescriptor;
import jakarta.validation.metadata.ConstraintDescriptor;
import jakarta.validation.metadata.PropertyDescriptor;
import org.hibernate.AssertionFailure;
import org.hibernate.MappingException;

View File

@ -14,7 +14,7 @@ import org.hibernate.HibernateException;
import org.hibernate.internal.util.collections.CollectionHelper;
/**
* Duplicates the javax.validation enum (because javax validation might not be on the runtime classpath)
* Duplicates the jakarta.validation enum (because jakarta validation might not be on the runtime classpath)
*
* @author Steve Ebersole
*/

View File

@ -10,7 +10,7 @@ import java.math.BigDecimal;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.RollbackException;
import javax.validation.ConstraintViolationException;
import jakarta.validation.ConstraintViolationException;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.beanvalidation.ValidationMode;

View File

@ -10,8 +10,8 @@ import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -9,9 +9,9 @@ package org.hibernate.jpa.test.beanvalidation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Size;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.constraints.Size;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;

View File

@ -10,8 +10,8 @@ import java.net.URL;
import java.util.Collections;
import javax.persistence.EntityManagerFactory;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import jakarta.validation.Validation;
import jakarta.validation.ValidatorFactory;
import org.hibernate.jpa.AvailableSettings;
import org.hibernate.jpa.HibernatePersistenceProvider;

View File

@ -14,8 +14,8 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Query;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.hibernate.Session;
import org.hibernate.dialect.PostgreSQL82Dialect;

View File

@ -9,12 +9,12 @@ package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
@Entity
public class Address {

View File

@ -7,7 +7,7 @@
package org.hibernate.test.annotations.beanvalidation;
import java.math.BigDecimal;
import javax.validation.ConstraintViolationException;
import jakarta.validation.ConstraintViolationException;
import org.junit.Test;

View File

@ -8,7 +8,7 @@ package org.hibernate.test.annotations.beanvalidation;
import java.math.BigDecimal;
import java.util.Map;
import javax.validation.ConstraintViolationException;
import jakarta.validation.ConstraintViolationException;
import org.hibernate.Session;
import org.hibernate.Transaction;

View File

@ -8,9 +8,9 @@ package org.hibernate.test.annotations.beanvalidation;
import java.lang.annotation.Annotation;
import java.math.BigDecimal;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import org.junit.Test;

View File

@ -8,10 +8,10 @@ package org.hibernate.test.annotations.beanvalidation;
import java.math.BigDecimal;
import java.util.Locale;
import javax.validation.ConstraintViolationException;
import javax.validation.MessageInterpolator;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.MessageInterpolator;
import jakarta.validation.Validation;
import jakarta.validation.ValidatorFactory;
import org.junit.Test;
@ -66,7 +66,7 @@ public class BeanValidationProvidedFactoryTest extends BaseCoreFunctionalTestCas
return interpolate( s, context );
}
};
final javax.validation.Configuration<?> configuration = Validation.byDefaultProvider().configure();
final jakarta.validation.Configuration<?> configuration = Validation.byDefaultProvider().configure();
configuration.messageInterpolator( messageInterpolator );
ValidatorFactory vf = configuration.buildValidatorFactory();
cfg.getProperties().put( "javax.persistence.validation.factory", vf );

View File

@ -8,8 +8,8 @@
package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -9,7 +9,7 @@ package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -10,8 +10,8 @@ import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -12,7 +12,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.PersistenceException;
import javax.validation.ConstraintViolationException;
import jakarta.validation.ConstraintViolationException;
import org.hibernate.Session;
import org.hibernate.Transaction;

View File

@ -9,7 +9,7 @@ package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -9,8 +9,8 @@ package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
/**

View File

@ -7,8 +7,8 @@
package org.hibernate.test.annotations.beanvalidation;
import java.math.BigDecimal;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
import org.junit.Test;

View File

@ -14,8 +14,8 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.constraints.NotNull;
import org.hibernate.Session;
import org.hibernate.Transaction;

View File

@ -16,8 +16,8 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.constraints.NotNull;
import org.junit.Test;

View File

@ -10,8 +10,8 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
/**
* @author Hardy Ferentschik

View File

@ -11,8 +11,8 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
/**
* @author Emmanuel Bernard

View File

@ -7,7 +7,7 @@
package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -15,8 +15,8 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -13,11 +13,11 @@ import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.validation.Valid;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Future;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.hibernate.validator.constraints.Length;

View File

@ -10,7 +10,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
/**
* @author Emmanuel Bernard

View File

@ -17,9 +17,9 @@ import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import org.hibernate.AnnotationException;

View File

@ -14,7 +14,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.hibernate.annotations.Cascade;

View File

@ -16,7 +16,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.hibernate.annotations.Cascade;

View File

@ -10,7 +10,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
/**
* @author Peter Kotula

View File

@ -0,0 +1,79 @@
/*
* 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.test.annotations.onetoone.hhh9798;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToOne;
import jakarta.validation.constraints.NotNull;
import java.util.Date;
@Entity
public class Shipment {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
protected Long id;
@NotNull
protected Date createdOn = new Date();
@NotNull
protected ShipmentState shipmentState = ShipmentState.TRANSIT;
@OneToOne(fetch = FetchType.LAZY)
@JoinTable(
name = "ITEM_SHIPMENT",
joinColumns =
@JoinColumn(name = "SHIPMENT_ID"),
inverseJoinColumns =
@JoinColumn(name = "ITEM_ID",
nullable = false,
unique = true)
)
protected Item auction;
public Shipment() {
}
public Shipment(Item auction) {
this.auction = auction;
}
public Long getId() {
return id;
}
public Date getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
public ShipmentState getShipmentState() {
return shipmentState;
}
public void setShipmentState(ShipmentState shipmentState) {
this.shipmentState = shipmentState;
}
public Item getAuction() {
return auction;
}
public void setAuction(Item auction) {
this.auction = auction;
}
}

View File

@ -11,7 +11,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
/**
* @author <a href="mailto:bernhardt.manuel@gmail.com">Manuel Bernhardt</a>

View File

@ -11,7 +11,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.AssertTrue;
import jakarta.validation.constraints.AssertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;

View File

@ -11,7 +11,7 @@ import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

View File

@ -16,7 +16,7 @@ import javax.persistence.OneToOne;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;