If you want to map those entities to 3 database tables, then you need to have:
a @ManyToOne association in User that references the Division
a @ManyToOne association to Division in SubDivision
Possible a bidirectional, mappedBy @OneToMany association in Division containing a List<SubDivision> and a bidirectional, mappedBy @OneToMany association in User containing a List<Division>.
Check out this article for more details about mapping a one-to-many table relationship with JPA and Hibernate.
Division To Sub-Division
id division_id sub_division_id
1 1 1
2 1 2
so on…
Finally when i create a user then assign particular division and sub-division.
Using following table
id user_id division_id sub_division_id
1 1 1 1
2 1 1 2
3 2 1 1
Drawback above table is linked in hibernate it will display all subdivision for every division. association only based on division id. but i need to associate with both user_id and division_id.
Above structure relationship is possible in hibernate for CRUD operation.
Then, just map each entity as I already explained and use associations. If you read the Hibernate User Guide, you will find everything you need to map these associations. If you skip the User Guide and think you don’t need it, you’ll keep on bumping on issues both in development and production.