javax.servlet
diff --git a/ebean-api/src/main/java/io/ebean/config/ClassLoadConfig.java b/ebean-api/src/main/java/io/ebean/config/ClassLoadConfig.java
index 821905405..764fa86a1 100644
--- a/ebean-api/src/main/java/io/ebean/config/ClassLoadConfig.java
+++ b/ebean-api/src/main/java/io/ebean/config/ClassLoadConfig.java
@@ -40,6 +40,13 @@ public class ClassLoadConfig {
return isPresent("javax.validation.constraints.NotNull");
}
+ /**
+ * Return true if jakarta validation annotations like Size and NotNull are present.
+ */
+ public boolean isJakartaValidationAnnotationsPresent() {
+ return isPresent("jakarta.validation.constraints.NotNull");
+ }
+
/**
* Return true if javax PostConstruct annotation is present (maybe not in java9).
* If not we don't support PostConstruct lifecycle events.
diff --git a/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java b/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
index 7ea8e56e9..036a39040 100644
--- a/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
+++ b/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
@@ -489,7 +489,7 @@ public class DatabaseConfig {
* Should the javax.validation.constraints.NotNull enforce a notNull column in DB.
* If set to false, use io.ebean.annotation.NotNull or Column(nullable=true).
*/
- private boolean useJavaxValidationNotNull = true;
+ private boolean useValidationNotNull = true;
/**
* Generally we want to perform L2 cache notification in the background and not impact
@@ -2809,7 +2809,7 @@ public class DatabaseConfig {
enabledL2Regions = p.get("enabledL2Regions", enabledL2Regions);
notifyL2CacheInForeground = p.getBoolean("notifyL2CacheInForeground", notifyL2CacheInForeground);
useJtaTransactionManager = p.getBoolean("useJtaTransactionManager", useJtaTransactionManager);
- useJavaxValidationNotNull = p.getBoolean("useJavaxValidationNotNull", useJavaxValidationNotNull);
+ useValidationNotNull = p.getBoolean("useValidationNotNull", useValidationNotNull);
autoReadOnlyDataSource = p.getBoolean("autoReadOnlyDataSource", autoReadOnlyDataSource);
idGeneratorAutomatic = p.getBoolean("idGeneratorAutomatic", idGeneratorAutomatic);
@@ -3056,20 +3056,21 @@ public class DatabaseConfig {
/**
* Returns if we use javax.validation.constraints.NotNull
*/
- public boolean isUseJavaxValidationNotNull() {
- return useJavaxValidationNotNull;
+ public boolean isUseValidationNotNull() {
+ return useValidationNotNull;
}
/**
- * Controls if Ebean should ignore &x64;javax.validation.contstraints.NotNull
+ * Controls if Ebean should ignore &x64;javax.validation.contstraints.NotNull or
+ * &x64;jakarta.validation.contstraints.NotNull
* with respect to generating a NOT NULL column.
*
* Normally when Ebean sees javax NotNull annotation it means that column is defined as NOT NULL.
* Set this to false and the javax NotNull annotation is effectively ignored (and
* we instead use Ebean's own NotNull annotation or JPA Column(nullable=false) annotation.
*/
- public void setUseJavaxValidationNotNull(boolean useJavaxValidationNotNull) {
- this.useJavaxValidationNotNull = useJavaxValidationNotNull;
+ public void setUseValidationNotNull(boolean useValidationNotNull) {
+ this.useValidationNotNull = useValidationNotNull;
}
/**
diff --git a/ebean-core/pom.xml b/ebean-core/pom.xml
index 20d9cfe6c..dcdad1b0e 100644
--- a/ebean-core/pom.xml
+++ b/ebean-core/pom.xml
@@ -138,6 +138,12 @@
1.1.0.Final
true
+