maitrayi vasishtha wrote:
Two beans can have same DB key but not same business key.
i have one doubt regarding above statement. If two beans have same DB key - that means both are representing the same row
How is it possible to have same DB but different business key?
For example there is record with values : username - johny , password - sadfafadf , firstName - john, lastName - neil and DB key of 1234 (assume business key is usename)
In session1 a instance obj1 holds the record and in session2 another instance obj2 holds the record and modified the username value.
Now if i am attempting to store both the instances into a SET , what would be the situation. Here both instances have same DB key but different bussiness keys. since we use business keys in equals method both the instances are different. If this is the case then does hibernate creates another record in the table. If so which instance will become a new record in the database.
What ever i raised above are doubts in my mind. Kindly resovle each of questions.