What is difference between accessing the table single column and accessing the tabe with multiple column key
By Ramakrishna on Oct 5, 2008 in hibernate interview questions
Rep)
1) If the above table has to be accessed using hibernate we must provide a seperae class to hold the values of the columns(multiple) of the primary key.(We can call this class as primary key class)
–>As part of Empaddressid,it will contain the properties such as setId,getId as partid of empno,addrno.
2) In case of table with single column as the primary key in the ‘hbm file’ we just use <id tag> But In case of the table with multiple columns as the primary key we must use <composite-Id–> tag as part of the hbm file
3) As part of the primary key class we must provide equals method to return true if both the objects represents the same primary key values and return false if two different object represents two different primary key values
4) As part of the primary key class we must provide the Hash Code method to return the same value for two different objects that are considered as
–>There is a different between the same and equal
5) The primary key class must implement java.io.serializable Interface.
