I have a general question concerning inserting records using hibernate.
I have a table with several columns that would make the "business" primary key and an id column as technical primary key.
As I don't want records doubled while inserting, using jdbc I would first check if the record I am going to insert, is in the table already using a select statement targeting the "business" primary key. If I find such a record, I would update it, otherwise insert it into the table.
One could say, make your business primary a technical composite id, but i don't like semantik keys.
How would I do that in hibernate? Is their a way to use a custom saveOrUpdate-Method telling hibernate to check coloumn 1 and column 2 and if they are equal just update?
Thanks for your help!
Rudolf
|