Home Hibernate XML Mapping for SelfJoin
Reply: 0

Hibernate XML Mapping for SelfJoin

user979
1#
user979 Published in May 21, 2018, 10:59 am

First of all I have to use XML mapping as I am not creating any POJO for my entities. I am using dynamic-map. So hibernate will create Maps to represent my entity(Every thing is same except that I am not specifying any POJO class name in my mapping).

I have to store(in the create page) Employee details along with the employee's Manager. Now when I open the detail page of an Employee, I have to show all the subordinate under that particular employee(if they have any). Assume below is the table details

empId
empName
managerId

Can some one kindly provide the hibernate mapping for the same. Also note that I prefer to have the subordinate association as read only. In the detail page I prefer to have the employ data retrieved like (JSON representation to define the object)

{empId:123,empName:"Manager",managerId:"1",
subordinates:[{empId:1000,empName:"sub1"},{empId:1001,empName:"sub2"}]}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.46147 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO