I feel you have two requirement:
1. implementing case-sensitivity on the database side(during INSERT)
2. implementing case sensitivity in the java application(after data retrieval)
As for #1, you should read relevant docs of your Database-server as to how to implement case-sensitivity...you may write even an INSERT trigger for this...or there might some easier way
As for #2, you will be able to get numerous tutorials(one is Sun Java Official Tutorial) as to how to implement equals..it is simple....even google serach may fetch you useful code
You need not worry as to how to hibernate takes care of equals method....when you check for object equality, Java Language automatically takes care of that....however remember database identity and Java equality(2 cases) are different.....you should read the book "Hibernate in Action" for this.
yuwaraj wrote:
Bibroy,
I have added unique constrain on name but is case sensitive such that if i adds an employee 'xyz' it allows me, so i need some kind of filter here.
Yes i was reading about overriding equals and i think it will help me but the only thing i do not understand how will Hibernate call this equals against all the employees which are already in the database. Here Hibernate need to maintain list of users to check against the user getting added or he need to fetch all the users at run time.
can you please help me configure my application such that i can override equals and hibernate will be able to call that method while inserting the employee.
I think this is the solution i am looking for.
Thanx in advance.