Domanda

How can we create a unique constraint in lift's mapper ?

È stato utile?

Soluzione

You can do that by adding the following in your MetaMapper object

override def dbIndexes=UniqueIndex(<name-of-the-field>)::super.dbIndexes

comma separated list of fields can also be provided

for example - UniqueIndex(name,dob)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top