How can we create a mapper with string as it's primary key in lift's Mapper ORM ?
Asked
Active
Viewed 344 times
2 Answers
1
As per my knowledge this should work..
class StringCodes extends KeyedMapper[String,StringCodes] {
def getSingleton = StringCodes
def primaryKeyField = languageCd
object strCd extends MappedStringIndex(this,5)
{
override def writePermission_? = true // if u want to set it via your code, keep this true
override def dbAutogenerated_? = false
override def dbNotNull_? = true
override def dbColumnName="str_cd"
}
....

vkantiya
- 1,343
- 1
- 8
- 20
0
From Lift documentation here:
Naturally Mapper also supports String primary keys, though your model class and companion object will need to mixin different traits and you’ll need to have a MappedStringIndex field.

Ignacio Cases
- 430
- 7
- 11