On Oct 31, 2006, at 1:30 PM, Baiss Eric Magnusson wrote:
On Oct 31, 2006, at 9:16 AM, Chuck Hill wrote:
On Oct 31, 2006, at 8:51 AM, Baiss Eric Magnusson wrote:
I need to add a BigDecimal to each Transaction record, I added it to
public class Transaction extends EOGenericRecord
as a local object. I don't instantiate it until it is needed.
My question is, even though it is transient, is it better to add it to the base EOModel, so it exists in the DB?
I've read that it is bad to put Objects in EO derived classes.
If I understand correctly, this is just a cached valued used for optimization.
Yes.
I'm assuming you're using EOGenerator and generating 2 different class files, right? That's really the best way to do it, then you add your variables in the non underscore class. I do this all the time.
It is not intended to be stored in the DB? I do this frequently for optimization and have seen no problems _provided that_ you are aware that EOF will update the underlying values and thus render this value inaccurate.
You're simply saying that the resultant of the changed values of the base record will affect the cached value, most certainly the case in most systems, IMO, and the case in the problem at hand, I use a <dirty> bit in the "helper" classes so that I do needed updates to transient objects, but I sometimes miss a few<g>. I have an intermediate state that will display a note at certain places.
What Chuck is saying is, we all "miss a few", so those variables should really be set via a notification from EOF. I listen for this notification:
EOObjectStore.ObjectsChangedInStoreNotification
This can be handled by watching for certain method calls into your EO from EOF and invalidating this value when they happen.
Sounds good.
I am pressed for time at the moment, so I can't go into details. I will attach example code that shows what to do (and much more).
Chuck
<GenericRecord.java>
--
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
----
Baiss Eric Magnusson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription: