I've been working with Hibernate for a little while now and been casually trying to solve this problem. Casually because it's quite minor to my needs but I'd like to figure it out once and for all. I wonder if anyone can help.
I want to have some related tables, lets say Country, City, District and Street and I want to relate them all in such a way that...
Country key=country name
City key=country name, city name
District key=country name, city name, district name
Street key = country name, city name, district name, street name
i.e. I don't want any numbered/generated primary keys and want to be able to link from any sub structure to any one of it's parent structures via one element of it's composite key but I cant see a way of doing this in Hibernate. This seems like a really basic thing so I'm guessing I'm overlooking something really obvious?
Also, there is no point in saving for example the country name in the city class in my domain objects so I'd like to avoid that.
Thanks in advance for any help
_________________ ##############################
If I helped, rate my comment, I have plenty of stupid questions to ask that I need credit for ;)
##############################
Last edited by rosswilliamdrew on Thu Apr 02, 2009 6:55 am, edited 1 time in total.
|