From: Gavin K. <ga...@ap...> - 2002-10-02 03:32:42
|
I prefer Anton's suggestion. There used to be a method like this on the session interface A Long Time Ago but I got rid of it because I didn't think it had anything to do with persistence. On the other hand, sessionFactory.openDatabinder().toXML(foo); does a really nice job of printing an object..... ----- Original Message ----- From: "Anton van Straaten" <an...@ap...> To: "Brad Clow" <bra...@wo...>; <hib...@li...> Sent: Wednesday, October 02, 2002 8:40 AM Subject: RE: [Hibernate] writing the properties of a persistent object to a string > I would find this useful. I rely on toString quite a bit. > > I assume that printToString could be added somewhere else, but would then > require a session object as a parameter? Or would that be very unnatural? > Design niceties aside, that would work fine for me. Would adding it to the > Hibernate class be any better from a reduced-interface-clutter perspective? > > Anton > > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...]On Behalf Of Brad Clow > Sent: Tuesday, October 01, 2002 5:43 PM > To: hib...@li... > Subject: [Hibernate] writing the properties of a persistent object to a > string > > > i often add a toString method (that prints out the values of all properties) > to my persistent objects so that i can get detailed logging of an object's > state when it is loaded, saved, etc. i have just written a printToString > method for the Session interface/SessionImpl class that does this > dynamically, taking into account proxy's, lazy collections and > PersistentEnum types, so i don't have to write & maintain the toString > methods (for this purpose) anymore. i know gavin would rather the Session > interface didn't grow anymore :-), but i think this may be useful for others > to. > > comments? > > brad > > > > ------------------------------------------------------- > This sf.net email is sponsored by: DEDICATED SERVERS only $89! > Linux or FreeBSD, FREE setup, FAST network. Get your own server > today at http://www.ServePath.com/indexfm.htm > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |