InterviewSolution
| 1. |
Suppose Your Class Has An Id Field, Should You Include In Equals()? Why? |
|
Answer» This QUESTION is asked to one of my readers as Hibernate Interview question, well including id is not a good idea in equals() method because this method should check equality based upon CONTENT and business RULES. Also including id, which is MOSTLY a database identifier and not AVAILABLE to transient object until they are saved into the database. This question is asked to one of my readers as Hibernate Interview question, well including id is not a good idea in equals() method because this method should check equality based upon content and business rules. Also including id, which is mostly a database identifier and not available to transient object until they are saved into the database. |
|