You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases we need to define multiple UniqueConstraint for entities. For example, we have a User entity which have 4 attributes -- id, userName, mobileNumber, email. Apparently the field id is the identification for a user, and the userName, mobileNumber and email is not.
Here a requirement comes. Though the userName, mobileNumber and Email is not an entity identification, we still want the user could login the system by either his userName, mobileNumber or email. It means, the userName/mobileNumber/email could identify a user. In this case, we need a multiple UniqueConstraint for these 3 fields.
Entity User {
Long id key;
- @Username userName; // basic type
- @MobileNumber mobileNumber; // basic type
- @Email email; // basic type
- @Password password; // basic type
}
The text was updated successfully, but these errors were encountered:
zhongweijun
changed the title
Templates: Supporting Multiple UniqueConstraint for entities
DSL & Templates: Supporting Multiple UniqueConstraint for entities
Apr 29, 2015
As a side note: The attribute "Long id key" is not valid here because this id attribute is added to every persistent domain object during model enrichment.
Regarding the id attribute Patrik stated in a forum post the following:
In Sculptor the id property has some very special meaning. It is always an autogenerated value. Used as primary key and foreign key relations.
In some cases we need to define multiple UniqueConstraint for entities. For example, we have a User entity which have 4 attributes -- id, userName, mobileNumber, email. Apparently the field id is the identification for a user, and the userName, mobileNumber and email is not.
Here a requirement comes. Though the userName, mobileNumber and Email is not an entity identification, we still want the user could login the system by either his userName, mobileNumber or email. It means, the userName/mobileNumber/email could identify a user. In this case, we need a multiple UniqueConstraint for these 3 fields.
The text was updated successfully, but these errors were encountered: