Mapping documents:
hi everyone,
I am new to hibernate and using spring framework. I have the Hibernate documentation but unable to figure out. I have been trying to define a mapping for a database insert and select but unable to do that. Kindly help. Following is the scenario:
I have following tables:
1) Plan (PlanId, Plan_Name, Type)
2) Plan_Task (PlanId, TaskId) ->> PlanId comes from table (1), TaskId comes from table table (4).
3) Plan_Activity (PlanId, ActivityId) ->> PlanId comes from table (1), ActivityId comes from table table (5).
Now, the first table i.e. Plan is the mater table and tables (2) Plan_Task and (3) Plan_Activity are child tables. In addition there are 2 more tables:
4) Task (Task_Id, Task_Name)
5) Activity (Activity_Id, Activity_Name)
Now iwhen the plan form is being displayed a list comes up which displays a list of Task ids and activity ids and the type i.e. radio to indicate whether the user wants to store a task or activity.
Based on the type i.e. either activity or task, the data will go to an appropriate table i.e either Plan_Task or Plan_Activity. I am not been able to define a mapping for this.
Kindly Help.
Regards,
Gaurav
|