Hi, I am using websphere application server and when i give the session.update it does not update the records in database.
and I do not see the SQL statements also.
This particular table does not have the primary key, so my question is if you do not have the primary key for the table, does session.update or session.saveOrupdate will work?
I think the problem is table does not have the primary key. This table is developed long back and more than 1 application is using this table and I cannot change this table.
And I am using middlegen to generate the mapping files and if you do not have the primary key, it makes all the columns as composite keys and i think we cannot update the keys by giving session.update.
Can somebody suggest others ways to handle this situation, where you do not have primary key and want to update records.
posted 15 years ago
My mapping file is and we are using :- net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
While the table may not define a primary key constraint, is there a column (or set of columns) that make up a logical primary key? If so, put this in your Hibernate mapping as the ID.
Can you provide the code and mappings so we can help? I don't see any reason why a table where every column makes up a composite ID wouldn't be able to be persisted. Is it an entity by itself, or a component in a collection of another entity?
posted 15 years ago
Thank you for responding back.
I thought you cannot update a primary key in update statement using hibernate, since my mapping tool generated all the column as keys.
Originally posted by srikanth koppisetty: I thought you cannot update a primary key in update statement using hibernate, since my mapping tool generated all the column as keys.
Sorry, I didn't think that through entirely before posting. Do any of those properties uniquely identify a row in the table? Is userId unique to each row or a combination of fewer properties than the entire table?
Stop it! You're embarassing me! And you are embarrassing this tiny ad!