I have find a problem that when an entity field with an @Column and then ,I overwrite the columnNameFromPropertyName in the Schema defineation,
trait IdTrait extends KeyedEntity[Long]
class Book(val id: Long, var title: String, @Column("coAuthorId") val authorId: Long, val coAuthorId: Option[Long]) extends IdTrait {
def this() = this(0, "", 0, Some(0))
}
object Library extends squeryl.Schema {
val book = table[Book]
on(book)(b => declare(
b.title is indexed
))
override def columnNameFromPropertyName(propertyName: String) = {
val camelCase: Array[String] = StringUtils.splitByCharacterTypeCamelCase(propertyName)
camelCase.toList.reduceLeft((a, b) => a + "_" + b.toLowerCase)
}
}
===================================Printed SQL Statement==============================================================
create table Book (
id bigint primary key not null auto_increment,
coAuthorId bigint not null,
co_author_id bigint,
title varchar(128) not null
)