This content has been marked as final.
Show 2 replies
-
1. Re: How to clone entity?
gjeudy Jul 18, 2008 8:29 PM (in response to terryb)If you clone a loaded hibernate entity you can't assume what you are dealing with exactly. It could be a hibernate proxy class... So for this reason I would stay away from this approach.
you probably want to create a new instance yourself and copy fields. Now if you don't want to hardcode the copying of fields method calls by method calls, you can probably use reflection to detect getters and call them or hibernate ClassMetaData if you want to focus only on properties that are mapped through hibernate.
-
2. Re: How to clone entity?
terryb Jul 19, 2008 4:32 PM (in response to terryb)Hi thanks for the reply. The hibernate ClassMetaData appears more appropriate for my case, however Im getting exception when it tries to access getter methods for property defiend in entity superclass. I have posted detailed information on hibernate forum.
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165494#4165494