0

i want to serailize & deserialized hibernate object. Can anybody tell me how can i achieve this?

Thanks

Deval
  • 93
  • 3
  • 10

1 Answers1

1

you can use SerializationHelper utility provided by hibernate, clone will do job for you. but if you want to save as new entity then make sure you reset id and version properties.

javadoc

one typical requirement i have used this to achive snapshot of current state of entity object, refer to my answer in post

Example:

  Entity object=SerializationHelper.clone(<Entity Object>);

This method will create clone (new object) by first serializing and then deserializing.

Community
  • 1
  • 1
Jigar Parekh
  • 6,163
  • 7
  • 44
  • 64
  • Ok i got this, but I need sample example for better understanding. Can you help me to provide me any example? – Deval Oct 25 '12 at 12:48