Employee.java: -------------- id(Column=id), name(column=name), subject(column=subject), List<Employee> (Mapping to department which returns list of employees from that department)
when i get the employee details based on the subject, it shud return the id, name, subject and list of other employees in that department.
We are using annotations. Can somebody help me with the mapping that needs to be given for the List<Employee> which is mapping to department.
Is it possible this way to return a list of the same objects?
Right now it looks like department is just a single field with one value. How can it hold a List.
You might have a Department table that in the Employee table has a FK id that maps to a record in the Department table. In that case you mappings should be ManyToOne from Employee to Department. but you cna also have a bi-directional association in Department that has a List of Employees.
But it looks like your table design doesn't support that and that your mappings doesn't show that.