
dao.Entity.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of squeryl-dao_2.12 Show documentation
Show all versions of squeryl-dao_2.12 Show documentation
This is a squeryl dao and some helpful db utilities.
The newest version!
package dao
import java.sql.Timestamp
import org.squeryl.{KeyedEntity, Optimistic}
trait IdEntity extends KeyedEntity[Long] {
def id: Long
override def isPersisted = id > 0
}
trait AuditedEntity extends IdEntity with Optimistic {
var dateCreated: Timestamp = new Timestamp(System.currentTimeMillis)
var createdById: Long = Entity.UnpersistedId
var lastUpdate: Timestamp = new Timestamp(System.currentTimeMillis)
var updatedById: Long = Entity.UnpersistedId
// todo these should probably be cached
//def createdBy: User = User.get(createdById)
//def updatedBy: User = User.get(updatedById)
}
trait AuditUser extends AuditedEntity {
def id: Long
}
object Entity {
val UnpersistedId: Long = -1
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy