CustomerEntity.kt — класс JPA Entity, совместимый с Spring Hibernate
Код: Выделить всё
@Serializable
@Entity
@Table(
name = CustomerEntity.Constants.TABLE_NAME,
indexes = [Index(name = "IX_Customer_CustomerName", columnList = "CustomerName")]
)
open class CustomerEntity(
@Id
@Column(name = Constants.COLUMN_ID_NAME, nullable = false, length = 15)
open var id: String = "",
@Column(name = Constants.COLUMN_CUSTOMERNAME_NAME, length = 40)
var customerName: String = "",
) {
object Constants {
const val TABLE_NAME: String = "Customer"
const val COLUMN_ID_NAME: String = "CustomerID"
const val COLUMN_CUSTOMERNAME_NAME: String = "CustomerName"
}
}
Код: Выделить всё
@Serializable
@Entity(tableName = CustomerSchema.TABLE_NAME)
class CustomerAndroid() : CustomerEntity() {
constructor(
customerID: String,
customerName: String = ""
) : this() {
this.id = customerID
this.customerName = customerName
}
@PrimaryKey
override var id: String = ""
}
Код: Выделить всё
Serializable class has duplicate serial name of property 'id', either in the class itself or its supertypes
Подробнее здесь: https://stackoverflow.com/questions/791 ... rializatio