Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Association problem

 
Danilo Dadonas
Ranch Hand
Posts: 59
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I working in a botton-up project. The database schema is precarious, but I cant�t change because all the system was developed precariously too. The problem is about 2 tables:
--------
Company
--------
id
name
phone
...
--------

-----------
Preferences
-----------
billing_address (FK - Company.id)
shipping_address (FK - Company.id)
...
-----------


I'm creating 2 class:
-----------------------
Company
-----------------------
int id
String name
String phone
Preferences preferences
-----------------------

-----------
Preferences
-----------
Company billingAddress
Company shippingAddress
...
-----------

If, for example, the billingAddress is the same, I'll refer like this:
references.billingAddress = this.
It's the solution I'm thinking about. There is other best way? Can Hibernate support it?

Thanks in advance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic