mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
#2220 - DDL generation of nullable columns expected with nullable Embedded containing non null properties
This commit is contained in:
1 parent
2d719c5b37
commit
bb6ff866c7
7 files changed
+19
-13
No files matched your search
+4
-4
@@ -175,7 +175,8 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
if (p instanceof BeanPropertyAssocOne) {
|
||||
visitOneImported((BeanPropertyAssocOne<?>)p);
|
||||
} else {
|
||||
visitScalar(p);
|
||||
// only allow Nonnull if embedded is Nonnull
|
||||
visitScalar(p, !embedded.isNullable());
|
||||
}
|
||||
if (embedded.isId()) {
|
||||
// compound primary key
|
||||
@@ -259,8 +260,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitScalar(BeanProperty p) {
|
||||
|
||||
public void visitScalar(BeanProperty p, boolean allowNonNull) {
|
||||
if (p.isSecondaryTable()) {
|
||||
lastColumn = null;
|
||||
return;
|
||||
@@ -292,7 +292,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
}
|
||||
} else {
|
||||
col.setDefaultValue(p.getDbColumnDefault());
|
||||
if (!p.isNullable() || p.isDDLNotNull()) {
|
||||
if (allowNonNull && (!p.isNullable() || p.isDDLNotNull())) {
|
||||
col.setNotnull(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user