Hello,
I have an application which is connected to a database. This database has three tables (for this scenario). The tables are ContactDetails, BillingDetails and ShippingDetails, where ContactDetails has a ForeignKey Relation to BillingDetails and ShippingDetails.
Thus I have created three POJO objects for each one of these tables, and then I save and load them according to how specified in the Hibernate Standard documentation.
All this works fine. However I now need to know whether the user has enter all the required data.
I though of two options on how to go forward…
1. Create another table named Progress, then create a POJO object named Progress. This table would have three fields, ContactId (Long), BillingAddressFilled (Byte), ShippingAddressFilled (Byte). When the user saved the contact details, apart from saving the contact details, he would also be creating a new record in the Progress table, then when he saves the billing address destails he would be setting the BillingAddressFilled field to 1, and so on. This sounds easy to make, however requires to save inside the Progress table for each save.
2. I would have a POJO that maps different fields inside different tables. For example it would map the ContactId from the ContactDetails table, the BillingId from the BillingDetails table and the ShippingId from the ShippingDetails table. However I am not sure how I can accomplish this with Hibernate, or whether it should really be made.
I would really appreciate any comments about this.
Best Regards,
Sim085
|