On Jun 18, 2007, at 11:48 AM, Michael Sims wrote:

To persist a detached object, I call a clone() function on all of my
DB objects that converts it back to a normal POJO (from whatever
Hibernate does to it.)

That's a good idea, and I might end up doing the same thing. The only thing I don't like about it is the overhead of implementing the clone() for each
persistent object, but I could learn to live with that.

I used Hibernate Tools to auto generate my POJOs, and I modified the template to create the clone() function automatically. I'm sure one could also do this via reflection via the DAO (look for all properties and copy them to a newly instantiated object.)

This approach uses no locks or mutexes.

That's definitely an advantage, especially to me, because I don't yet trust myself enough to write too much code that uses locks and be confident that
I've done it properly and in a way that can scale...

I always expect bad things when using locks, especially in an environment as random as the web.

-Norman




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to