Originally posted by Bougnon Kipre:
Yes, it is possible to have a table w/o a primary key.
However, hibernate will use what you program in the id
(single field or composite).
As long as you code this in your equals method, you should be fine.
No, this is not the case. You might get away with it, but its not
guarenteed to work.
It is possible to define an entity without a primary key in a relational database, but its not a smart thing to do. Without a primary key there is no way to identify a single row. If you can't identify a single row, it can't be used in a relationship, hence is not relational data. Because of this requirement Hibernate does not easily support tables without primary keys. There are work arounds (map all the fields in the the table as a composite key for example) but none are as easy as just giving your table a surrogate key.