David Kubecka
01/17/2023, 12:54 PMBaseEntity (from which all other non-embeddable entities in my model inherit):
@Id
@GeneratedValue
var id: Long? = null
A framework I'm currently integrating would benefit from having the annotations on the getters instead of fields so I did this:
@get:Id
@get:GeneratedValue
var id: Long? = null
Once I do that (and only that) I run into really weird Hibernate errors on the app startup, e.g. Could not locate setter method for property [com.vacuumlabs.robo.backend.entities.Money#amount]. Well, Money#amount is indeed just a val but how is that related to moving the @Id annotation to the getter? Moreover, Money is exactly an embeddable entity that does not inherit from BaseEntity ...
Okay, so I switch it to var and I get another error (from complete different entity): Unable to create unique key constraint (client_id, iban) on table account: database column 'client_id' not found. But of course the client_id column is there and if I switch the @Id back to the property annotation then my app starts and runs ok.
I'm afraid I might be running into some generic issue here. Did anyone else encounter this?Dirk Luijk
05/10/2023, 3:23 PMDavid Kubecka
05/16/2023, 1:38 PM