mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
#2855 - @DbArray not allowing null to be persisted, stores empty list instead
Currently, this bug fix needs to be enabled explicitly via ebean.mf with: allow-nullable-dbarray: true We will look to enable this bug fix by default shortly noting that some code will see a behaviour change. We need to publicise it well when we do turn this on by default. This bug fix is actually in ebean-agent 13.10.0 and all this change in ebean-core does is read the new `@DbArray(nullable=false)` attribute [as a new alternative to using `@NotNull` or `@Column(nullable=false)`]
This commit is contained in:
1 parent
475f937421
commit
9a25fb584c
5 files changed
+33
-6
No files matched your search
@@ -171,6 +171,11 @@ public final class DeployUtil {
|
||||
* Set the DbArray type (effectively Postgres only).
|
||||
*/
|
||||
void setDbArray(DeployBeanProperty prop, DbArray dbArray) {
|
||||
if (!dbArray.nullable()) {
|
||||
// Non-nullable ScalarTypeArray's will auto bind null to empty array, we need to
|
||||
// set nullable(false) before the ScalarTypeArray is determined and assigned
|
||||
prop.setNullable(false);
|
||||
}
|
||||
Class<?> type = prop.getPropertyType();
|
||||
ScalarType<?> scalarType = typeManager.getArrayScalarType(type, prop.getGenericType(), prop.isNullable());
|
||||
if (scalarType == null) {
|
||||
|
||||
Reference in new issue
Block a user