Hi,
I am running the sample testing code and getting the following issues:
(1) In the TestCaseWithData.java there are two objects with type of BillingDetails created. One with Owner Name to be "Christian Bauer" and another with Owner Name to be"Christian Bauer". There is one extra space between those two owner names in order to distinguish them as different string. In fact if changing those two owner names to be the same, the generated database record in billing_details table will have only one row. The problem is that the OWNER_NAME column is not a unique key. Theoretically it should allow having same name of different rows in this table.
(2) One step further, utilizing existing mapping, I created a simple testing code to retrieve the BillingDetails from User utilizing the method user.getBillingDetails(). What I realized is that Hibernate actually try to differentiate each retrieved row by comparing values of every column except primary key column. This will result partial records being retrieved when doing retrieving by foreign key. In this case I couldn’t retrieve all rows with same USER_ID in billing _details table, as long as the columns have same value except primary key.
What I missed here? Please help. Thanks in advance.
|