Khurram Malik
12/31/2021, 8:45 PM/**
* Identity table with autoincrement integer primary key
*
* @param name table name, by default name will be resolved from a class name with "Table" suffix removed (if present)
* @param columnName name for a primary key, "id" by default
*/
open class IntIdTable(name: String = "", columnName: String = "id") : IdTable<Int>(name) {
final override val id: Column<EntityID<Int>> = integer(columnName).autoIncrement().entityId()
final override val primaryKey by lazy { super.primaryKey ?: PrimaryKey(id) }
}This field was earlier not final and we were able to override it for several tables by combining/linking two tables:
object AnswersInQuestionTable : IntIdTable("answers_in_question"){
val question = reference("question_id", QuestionsTable)
val answer = reference("answer_id", AnswersTable)
override val primaryKey = PrimaryKey(question, answer)
}This is a an issue for our web service. Anyone who know what the best practice(s) are for resolving that?
dave08
01/02/2022, 4:13 AMKhurram Malik
01/02/2022, 5:56 PM