openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henno Vermeulen <>
Subject RE: How to persist duplicate of an entity?
Date Fri, 14 Jan 2011 14:52:12 GMT
The easiest way that I found to create a deep clone of an object graph is to use apache commons

Can of course also be used for a simple entity without relations. In anyway you have to watch
out that you still set all primary keys to null. (May also not be most performant way.)

Henno Vermeulen
Huize Molenaar

-----Oorspronkelijk bericht-----
Van: Ognjen Blagojevic [] 
Verzonden: vrijdag 14 januari 2011 15:12
Onderwerp: How to persist duplicate of an entity?


Is there an easy way to create duplicate of an entity?

I want to read entity from the DB, and then persist (almost) identical 
copy. Every field should be the same, except primary key.

I know I could probably use BeanUtils.copyProperties, but is there 
OpenJPA preffered way to do the duplication?


View raw message