I'm very new to Scala, Play Framework and Squeryl. I already understand the concepts of val and var, but I'm having a hard time on trying to model my entities. As I saw on Squeryl documentation, sometimes they use var on id and other times use val. What is the best approach for id and other values(sometimes they use var/val and other times Option, last one is only for nullable fields on entities)?
Example 1
class Playlist(var id: Long,
var name: String,
var path: String) extends KeyedEntity[Long] {
}
Example 2
class Author(val id: Long,
val firstName: String,
val lastName: String,
val email: Option[String]) {
def this() = this(0,"","",Some(""))
}
And why sometimes they extend the KeyedEntity[T] and sometimes don't?
I really appreciate some help!