HHH-13950 Apply the mass replace script to switch to Jakarta Validation API

For reference, this is the script being applied:
find . -type f -name '*\..java' -o -name '*.\.adoc' -o -name '*.\.gradle' | xargs sed -i 's/javax\.validation/jakarta\.validation/g'
This commit is contained in:
Sanne Grinovero 2020-04-20 12:09:42 +01:00
parent b9a24f458c
commit 60abc8aa76
41 changed files with 92 additions and 92 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

@ -138,11 +138,11 @@ 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 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=!',

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

@ -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

@ -14,7 +14,7 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import java.util.Date;
@Entity

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

@ -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;

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;