Thanks very much for all the help guys. Hanson - I have looked at beanlib already, as my goal here is populating DTOs from Entity beans and vice versa using hibernate. I attempted to get something working with beanlib-hibernate but unfortunately due to the lack of documentation I gave up and tried with BeanUtils - I could not get the hibernate2dto() methods working correctly. However, the BeanPopulator has done the trick here - so thanks again.
I like the look of Morph - great documentation here. If I get any time I will give it a go. The main problem I am having is specifying how deep in the object graph that my assemblers should go, and how to not overwrite existing entities in the database that are associated separately to the entity graph I am persisting. Bloody pain in the neck! Thanks again, Tom > Date: Fri, 3 Oct 2008 12:32:22 -0700 > From: [EMAIL PROTECTED] > Subject: Re: BeanUtils copyProperties with null Date > To: [email protected] > > > --- Hanson Char <[EMAIL PROTECTED]> wrote: > > > Or as a comparison, you can achieve the copying via > > BeanPopulator of > > beanlib, and it would just work. See sample code > > below. > > > > > > > http://sourceforge.net/project/showfiles.php?group_id=140152 > > > > Cheers, > > Hanson > > > > import java.util.Date; > > > > import net.sf.beanlib.provider.BeanPopulator; > > > > public class Bean1Bean2Main { > > public static void main(String...args) { > > Bean1 b1 = new Bean1(); > > Bean2 b2 = new Bean2(); > > > > BeanPopulator.newBeanPopulator(b1, > > b2).populate(); > > System.out.println(b1.getDate()); > > System.out.println(b2.getDate()); > > > > b1.setDate(new Date()); > > BeanPopulator.newBeanPopulator(b1, > > b2).populate(); > > System.out.println(b1.getDate()); > > System.out.println(b2.getDate()); > > } > > } > > > > FWIW, the simplest approach to this in Morph > (http://morph.sourceforge.net) should be: > > Morph.copy(b2, b1); > > -Matt > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > _________________________________________________________________ Make a mini you and download it into Windows Live Messenger http://clk.atdmt.com/UKM/go/111354029/direct/01/
