https://kotlinlang.org logo
#exposed
Title
# exposed
w

Wxffel

03/16/2023, 5:33 PM
It is tricky for us because the primary key is not an int. It is a compound key which consists of the CustomerID and the BoatID. It looks like this in our code:
Copy code
object Rents : Table("T_Rents") {
    val customerId = reference("Customer_Id", Customers.id)
    val boatId = reference("Boat_Id", Boats.id)
    val dateOfRent = datetime("Date_of_rent")
    val dateOfReturn = datetime("Date_of_return")

    override val primaryKey = PrimaryKey(customerId, boatId, name = "CustomerAndBoatID")
}
How would we create an entity in this table?
a

Andrew O'Hara

03/16/2023, 5:57 PM
When faced with a similar issue, I opted to use the table DSL directly. There may be a workaround to make it work with an entity, but I don't know it.
1
w

Wxffel

03/16/2023, 6:11 PM
Thank you! It worked.
p

PoisonedYouth

03/16/2023, 6:35 PM
Yes by using the table DSL its easy to create all kind of relations, the DAO is limited in some cases.
7 Views