> Now, as things stand, torque will re-generate the User object as many
> times as it is referenced. This means bloated memory. Even worse, as
the
> user knows the transaction and the transaction knows the set, the
> encoder will traverse all these links, every time encountering a new
> object and hence the graph traversal never ends.
> (I did not play with putting meaningful equals on my objects, I may
have
> made the situation more simple that way, but it has other negative
side
> effects, and I fear another quagmire....)

I only have a few quick minutes, so I can test or fix anything (assuming
it's broken), but I'm fairly sure that if you do:

obj.getOtherObj()

As would be generated by the complexObjectModel stuff, another call to:

obj.getOtherObj()

should indeed return the same otherObj as obj will have a data member
that points to otherObj and only load it if the data member is null.

I say should as I know currently the save method does not propagate
across relations, and though it's not directly related, it gives me
enough suspicion that I can't say it works for sure without looking at
the code. If it doesn't, it should, and we can fix it.

The other point I think you bring up is that if you have a user object
with id=5, let's say, and out of the blue obj.getUser() is called, it
will get a create a brand new object with user id=5.

This is probably the best behavior in most guesses, as you avoid
threading issues, but I can see where you would want the other
functionality (in that if the user with id=5 is already in system,
regardless of whether obj "knows" about it or not, with obj.getUser() is
called and it looks for one with id=5, it should find the object already
in memory instead of hitting the database. Correct?

If so, this should be fairly easy to add by using the existing managers
and do XxxManager.getInstance(key) in the relation accessors that
normally just hits the database.

I'm not entirely sure I read your email correct...does this sound right?

- Stephen


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

Reply via email to