I may be wrong but from my reading, I seem to recall that JPA supports unregistered objects, so JPA may be able to help you here. I think JPA also supports non-persisted objects in the class hierarchy, so you might even be able to define a TemporaryMeeting subclass (or superclass) of Meeting that would never be persisted.
On 8/10/07, Peter Karich <[EMAIL PROTECTED]> wrote: > Hallo, > > as discussed here [1] and there [2]. > I am seeking for a solution where the following works: > > Room r = new Room(); > getContext().registerNewObject(r); > > Meeting m = new Meeting(); > r.addMeeting(m); //[3] > > I get heavy memory problems in my calculations, while doing the > following procedure 100,000 times: I create a meeting, calculate sth. > and remove it. Cayenne forces me to register all the 'meetings' and will > reference them although I don't need them anylonger. But I don't know > when I won't need them. > > So one solution comes from Mike Kienenberger as discussed before and > another solution could be to create sth. like a readonly context, where > I could copy the results in a normal DataContext if I am done. So can I > simply put the objects into the ObjectStore by a WeakReference or should > I know more about the internals. (I think I should!) > May be a readonly context could even improve performance, because of the > nonexistent 'registering' overhead. > > > Now my questions are: > 1. Is there already a (similar) solution for the ReadOnlyContext? > 2. Will cayenne implement Mike Kienenberger's solution? Or others? Can I > open a JIRA issue/feature request [3]? > 3. Are there other ORM's that solve this. (Not worth to exchange, but > worth to know :-) > 4. Could JPA help me here or will cayenne silently 'add the meetings' as > in normal cayenne setup? > > > Bye, > Peter. > > > [1] > http://objectstyle.org/cayenne/lists/cayenne-user/2007/03/0181.html > > [2] > http://objectstyle.org/cayenne/lists/cayenne-user/2007/04/0054.html > > [3] > Where the user can decide if a context does then > "throw an explicit exception", "add m silently and make it persistent" > or "add m silently, but don't make persistent", if an unregistered > object like 'm' will be added to a registered one like 'p' (or the other > way around) > And without registering one object (2 unregistered) cayenne shouldn't > throw NPE's. >
