1

I have some requirement and didn't find any thing, could you please verify following

I have entity object (Hibernate) and it has some relation ships as well. around 10 tables involved in that entity. I just want to clone this entity object and same thing needs to be stored in DB all tables.

I'm using Hibernate, spring, struts2

is there any way to clone entity?

Roman C
  • 49,761
  • 33
  • 66
  • 176
1097733
  • 467
  • 3
  • 9
  • 18

1 Answers1

0

You need to:

  1. detach the Entity from the EM;
  2. reset the @Id;
  3. persist the Entity.

as described here, and confirmed here.

Community
  • 1
  • 1
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243