baliukas wrote:
Quote:
It must be better to have generated id as primary key, probably user will want to change nickname (mutable key is not a good candidate for primary key) just add "UNIQUE" constraint for nickname
I think you are right.
Anyway I would like to clarify the aim of my java app for you to better advice me.
It's a web spider that collects user profiles from a web community (in which users must be registered).
Users aren't known in advance in my database. They instead have to be provisioned to my database by the spider. Moreover their nicknames are unique and immutable as requirement.
So the most typical task the spider has to execute is a "saveorupdate" of the profiles that it collects by surfing automatically and parsing the html source of the profile pages.
My question is: how can I implement proper update policy based on nickname equality? (Note that "save" isn't yet problematic by following your previous advice)
I have read in the "Equals and HashCode" document in the community area at
http://www.hibernate.org/109.html that is goog thing to keep separate oid from actual business row identifier...