ObjectDB ObjectDB

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 

Manoj Kumar Maharana
edit
delete
#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)
edit
delete
#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)

 

Manoj Kumar Maharana
edit
delete
#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)
edit
delete

Reply

To post on this website please sign in.