I was only commenting on the point you made regarding >No, you can't "refresh" an instance - only replace it. You'd have to >write code in your entity to replace all its properties with those from >another instance.
You'd get lazy loading with it, like this: Load Entity Detach Entity Edit entity in the page <Worried about multi-threaded access> Retrieve the original entity Merge the old entity with the new edited version (custom code I mentioned before) Save the updated entity Chris -----Original Message----- From: Daryl Stultz [mailto:[email protected]] Sent: Friday, 18 September 2009 9:15 PM To: [email protected] Subject: Re: EntityManager used in multiple threads On Fri, Sep 18, 2009 at 9:05 AM, C N Davies <[email protected]> wrote: > You can read the parameter and return types from the methods to work out > what the types are. > > I meant for any given property (single or collection), you don't want to read it in if it's set to LAZY, so you would need to read the annotation on the field/getter. Maybe it's harder than that. If the field has already been loaded if LAZY, then you do want to read it in. How would you find out if a field has been loaded? You can't read the field from the "master" entity because if it's detached and unloaded field access is disabled it will crash. Ok, you could trap for that. But still, comparing to null isn't the best way if the value is nullable. Also, the master entity might be managed rather than attached, so you don't want to load a large collection marked as LAZY accidently. Am I making sense? I am interested in a generic "self-refresh" method. I think it's possible, but I don't really need it right now. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:[email protected]
