domain classes:
class Carnet extends Purchasable{
Payment payment
}
class Training extends Purchasable{
static hasMany = [payments:Payment]
}
class Payment {
static belongsTo = [purchase:Purchasable]
}
class Purchasable {
Float price
static constraints = {
}
static mapWith = "none"
static mapping = {
tablePerHierarchy false
}
}
unfortunatelly when I try to grails run-app
I've got:
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000388: Unsuccessful: alter table payment add constraint FK_6ohgqce5txqxe8l8wkkkgjlc0 foreign key (purchase_id) references training (id)
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't write; duplicate key in table '#sql-690_99'
Application is starting but carnet table in db is not created so later I receive MySQL exceptions. moreover purchasable table is created (and i do not need it at all).
I tried to move Purchasable
as an interface to src/groovy but I'm not sure how to do it properly. Do you know how to fix it?