The scenario:
1. Customer has homeAddress, workAddress, billingAddress and shippingAddresss
2. Employee has homeAddress1, homeAddress2, hiringOfficeAddress, currentDeploymentAddress
3. Organization has hqAddress
4. All these addresses follow the same format: Street Number, Street Name, Street Type, City, State, Country and additional description (free text field that may contain an apartment
unit number, or something else)
So, I may encapsulate properties listed in number 4 in an "Address" class and include it in my Customer, Employee and Organization class. This is the table structure properties of address:
a. StreetType --> id, name (e.g 1 - Street, 2 - Court, 3 - Lane)
b. Country --> country_code, country_name (e.g GBR - Britain, USA - United States of America, AUS - Australia)
c. state --> country_code,state_code,state_name (e.g AUS - VIC - Victoria)
d. city --> country_code,state_code,city_code,city_name (e.g AUS - VIC - MELB - Melbourne)
e. all address fields in customer, employee and organization will consist of these fields : streettype_id (FK to point a), streetNumber (standard independent integer input field), streetName (standard independent nvarchar input field), city_code + state_code + country_code (FK to point d) and finally AdditionalInfo (standard independent nvarchar input field).
For now, I have the following:
and I got java.sql.SQLException: Invalid column name 'streettype'. How should I annotate my classes in this case?
The database structure is already like that (legacy system), so changing the table structure is out of the question.
thanks