Forums Register Login

Inserting a record when the table has no primary key

+Pie Number of slices to send: Send
Hi,

I'm working with sybase database. The table I am trying to insert a record has no primary key. How could I insert a record in this table?

I believe hibernate allows native JDBC sql query. I could use that to persist a record but was wondering if anyone has a better suggestion to offer.

Thanks.
+Pie Number of slices to send: Send
No PK == a broken data model. The best fix for this is to correct this error.

That being said, you can work round it. Map the table with a composite id using all the fields in the table. This will work most of the time (though since there is no PK constraint you can guarentee it will work all of the time).
The fastest and most reliable components of any system are those that are not there. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1107 times.
Similar Threads
sending values from one table to other..
relation without ID attribute
Sequence number in oracle using Entity Bean
Insert/Update if no record there
problem while inserting the record in db using mySQL
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:06:15.