Fast Object Database for Java - with JPA/JDO support

How can allow multiple null value in a Unique column.

#1

I have a entity Person have 2 fields Name(Unique) and PhoneNumbers. I wants to allow null value for name.How can i achieve this?

 

I have attach my entity class for your reference.

Thanks 

#2

ObjectDB considers a null value as any other value, so indeed, for a unique field you cannot have more than one null value. If you need multiple null values then the field should not be defined as unique.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

How can i apply Unique in not null value of a Column?

Eg:

Name : null (allow)

Name : xyx (allow)

Name : null (allow)

Name : abc (allow)

Name : xyz (not allow)

 

#4

You cannot use unique in this scenario, i.e. it would be your application responsibility to enforce such a constraint.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply