Printer.toString() does *not* call toString() on the entity objects!

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Max
Rydahl Andersen
Sent: Wednesday, 18 May 2005 3:45 AM
To: Hibernate devel
Subject: [Hibernate] Printing entities on flush in debug mode ?

Hi guys,

Is the line
new Printer( session.getFactory()  
).toString( persistenceContext.getEntitiesByKey().values().iterator(),  
session.getEntityMode() );
in AbstractFlushingEventListener really necessary ?

It can/will cause ConcurrentModificationException if you e.g. have debug

on and this "innocent" toString method on your objects and
your customer is not yet initialized.

class Order {

    String toString() {
       return "Order " + getId() + " for customer " +
getCustomer().getId()  
+ " in " + getCustomer().getLocation();

    }
}

/max



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to