say i have Book and Page classes. a Book has a name and can also have many 
Pages. a Page has a number, and a reference to the owning Book.

i want the Page's ID to be based on it's number, and ALSO the owning Book's 
name. i could make an ID class for Page, but the fields of the ID class need to 
be simple types, so i can't map them to the book field in Page ... ?

i did get it to work by adding a bookName field to Page that gets populated in 
the setBook() setter, and creating a PageId that uses the Page's number and the 
simple bookName field. 

however, this seems wrong, as it results in redundant data stored in the Page 
table. for example, the created table for Page has  NUMBER, BOOKNAME, and 
BOOK_BOOK_NAME columns, the latter two of which are always the same. 

i am sure there's a best practice for this. any advice is appreciated.

i have a test case for this i can send if my description is not obvious, but my 
last attempt failed apache's spam filter. 



 
---------------------------------
Don't get soaked.  Take a quick peek at the forecast 
 with theYahoo! Search weather shortcut.

Reply via email to