Why do we use @Embeddable In Hibernate

前端 未结 3 553
Happy的楠姐
Happy的楠姐 2020-11-30 22:41

What\'s the use of @Embedded and @Embeddable In Hibernate ? Because every example i found on internet is inserting data inside of a single table an

3条回答
  •  猫巷女王i
    2020-11-30 22:47

    suppose we have employee table annotated with @entity and employee has Address so here i dont want to create two tables i.e employee and address, i just want create only one table i.e employee not Address table then we need to declare Address instance in Employee and add @embedable annotation on top of Address class, so finally we get table employee with its record and address records as well in single employee table

提交回复
热议问题