Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 16345 invoked from network); 5 Oct 2008 10:58:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Oct 2008 10:58:46 -0000 Received: (qmail 4346 invoked by uid 500); 5 Oct 2008 10:58:41 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 4261 invoked by uid 500); 5 Oct 2008 10:58:41 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 4250 invoked by uid 99); 5 Oct 2008 10:58:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Oct 2008 03:58:41 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of fiznool@hotmail.com designates 65.54.246.108 as permitted sender) Received: from [65.54.246.108] (HELO bay0-omc1-s36.bay0.hotmail.com) (65.54.246.108) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Oct 2008 10:57:37 +0000 Received: from BAY131-W12 ([65.55.136.47]) by bay0-omc1-s36.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 5 Oct 2008 03:57:50 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_2fbf0db5-4b4d-4290-a657-12cc09b60366_" X-Originating-IP: [77.101.214.1] From: Tom Spencer To: Commons Users List Subject: RE: BeanUtils copyProperties with null Date Date: Sun, 5 Oct 2008 11:57:51 +0100 Importance: Normal In-Reply-To: <640847.36244.qm@web55104.mail.re4.yahoo.com> References: <640847.36244.qm@web55104.mail.re4.yahoo.com> MIME-Version: 1.0 X-OriginalArrivalTime: 05 Oct 2008 10:57:50.0918 (UTC) FILETIME=[35CD5E60:01C926D9] X-Virus-Checked: Checked by ClamAV on apache.org --_2fbf0db5-4b4d-4290-a657-12cc09b60366_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thanks very much for all the help guys. Hanson - I have looked at beanlib a= lready=2C as my goal here is populating DTOs from Entity beans and vice ver= sa using hibernate. I attempted to get something working with beanlib-hiber= nate but unfortunately due to the lack of documentation I gave up and tried= with BeanUtils - I could not get the hibernate2dto() methods working corre= ctly. However=2C the BeanPopulator has done the trick here - so thanks agai= n. I like the look of Morph - great documentation here. If I get any time I wi= ll give it a go. The main problem I am having is specifying how deep in the= object graph that my assemblers should go=2C and how to not overwrite exis= ting entities in the database that are associated separately to the entity = graph I am persisting. Bloody pain in the neck! Thanks again=2C Tom > Date: Fri=2C 3 Oct 2008 12:32:22 -0700 > From: gudnabrsam@yahoo.com > Subject: Re: BeanUtils copyProperties with null Date > To: user@commons.apache.org >=20 >=20 > --- Hanson Char wrote: >=20 > > Or as a comparison=2C you can achieve the copying via > > BeanPopulator of > > beanlib=2C and it would just work. See sample code > > below. > >=20 > > =20 > > > http://sourceforge.net/project/showfiles.php?group_id=3D140152 > >=20 > > Cheers=2C > > Hanson > >=20 > > import java.util.Date=3B > >=20 > > import net.sf.beanlib.provider.BeanPopulator=3B > >=20 > > public class Bean1Bean2Main { > > public static void main(String...args) { > > Bean1 b1 =3D new Bean1()=3B > > Bean2 b2 =3D new Bean2()=3B > >=20 > > BeanPopulator.newBeanPopulator(b1=2C > > b2).populate()=3B > > System.out.println(b1.getDate())=3B > > System.out.println(b2.getDate())=3B > >=20 > > b1.setDate(new Date())=3B > > BeanPopulator.newBeanPopulator(b1=2C > > b2).populate()=3B > > System.out.println(b1.getDate())=3B > > System.out.println(b2.getDate())=3B > > } > > } > >=20 >=20 > FWIW=2C the simplest approach to this in Morph > (http://morph.sourceforge.net) should be: >=20 > Morph.copy(b2=2C b1)=3B >=20 > -Matt >=20 > > > --------------------------------------------------------------------- > > To unsubscribe=2C e-mail: > > user-unsubscribe@commons.apache.org > > For additional commands=2C e-mail: > > user-help@commons.apache.org > >=20 > >=20 >=20 >=20 >=20 > =20 >=20 > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: user-unsubscribe@commons.apache.org > For additional commands=2C e-mail: user-help@commons.apache.org >=20 _________________________________________________________________ Make a mini you and download it into Windows Live Messenger http://clk.atdmt.com/UKM/go/111354029/direct/01/= --_2fbf0db5-4b4d-4290-a657-12cc09b60366_--