Hi all, I am updating a table which has no primary key. The table contains only non key attributes. If i want to insert record, Can i do using hibernate? Because in my understanding of hibernate, without an ID attribute, table can't be inserted. How to achieve this?
exactly. Hibernate must have an id field so that it can match the object instance to one and only one record in the database.
If the table does not have a PK field, does it have a unique index or combination of fields that will uniquely identify the single row in the database. If so you can create a composite-id with the composite including all those fields.
If, however, there is no unique combination of fields then you data table can allow duplicates, then Hibernate can't help you there, I recommend using a surrogate primary key, if you are allowed to add one. If not, sorry you are out of luck. We have that with one or two of our tables and we can't change it at the moment, too risky close to a deadline, so we are SOL
You are suggesting me my point of keeping an ID attribute in Hibernate is must. If i don't have ID attribute for my relation, I can use Combination of attributes which selects me unique records. That's fine. But four or five of my tables come under 3rd category of having surrogate keys. If i use these surrogate keys, in future, will it disrupt my schema design?
Abu.A
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
a bit of art, as a gift, the permaculture playing cards