Copying DataObjects

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Wed Mar 23 2005 - 17:35:52 EST

  • Next message: Cris Daniluk: "RE: Copying DataObjects"

    I've been thinking about posting this to the wiki, but not
    sure if it would be valuable to anyone else.
     
    We frequently have a need to copy the properties of
    DataObjects back and forth (either to other DataObjects, or
    to beans further down the chain). BeanUtils is an obvious
    choice, but unfortunately it takes properties from
    CayenneDomainObject as well (specifically, the persistence
    state). To solve that, I wrote a quick little version of
    BeanUtils.copyProperties that only considers properties which
    contain the..ersistent annotation. Attached are the files
    necessary to make this work. Just make sure that the class
    files are accessible when building your data objects. Then
    use PersistentBeanUtils.copyProperties to copy only the
    properties of the data object itself.

    Of course, this only works w/JDK 1.5...

    Cris









    This archive was generated by hypermail 2.0.0 : Wed Mar 23 2005 - 17:35:49 EST