cancel
Showing results for 
Search instead for 
Did you mean: 

email id should not added morethan once in model.

0 Kudos
195

I have a model and storing email to that. but how would I stop allowing duplicate entry on model. even in items.xml i have made it as unique.

items.xml:

                 <persistence type="property" />
                     <modifiers unique="true" optional="false" initial="true" />


ex: final NewsLetterEmailModel emailModel = new NewsLetterEmailModel(); emailModel.setEmail(email); modelservice.save(emailmodel)

regards, Mohiddin

Accepted Solutions (1)

Accepted Solutions (1)

hiddebroerse
Participant
0 Kudos

Before saving a new NewsLetterEmailModel you should query your database if an entry with the same email value already exists.

Answers (0)