BlackLabs / play-morphia

Provide mongodb access service to play.db.Model via Morphia
Apache License 2.0
130 stars 49 forks source link

@Unique validation not working correctly when updating record #96

Closed mardo closed 11 years ago

mardo commented 12 years ago

When creating a new record, the unique validation works good. When updating a record, it checks only with the current record, and it should be the opposite: to check all records except the current record.

I found the problem in UniqueCheck.java at line 83, To resolve this, change this line to:

q.field(keyProperty).notEqual(keyValue);

Regards, Mardo Del Cid.