Re: Direct to Java Client and frameworks
Re: Direct to Java Client and frameworks
- Subject: Re: Direct to Java Client and frameworks
- From: Robert Walker <email@hidden>
- Date: Mon, 3 Oct 2005 16:35:56 -0400
The next step was to add an awakeFromInsertion() method on one of
the classes in my framework to supply default values for
properties. This doesn't appear to be being invoked on the client
(no default values), but is invoked on the server when the client
saves the data record (which means that it changes the value that
user has entered!).
This is definitely an issues with JavaClient applications. The
behavior you described here is exactly what happens. The only
solution I've found is to do something like this:
public void awakeFromInsertion() {
if (entryTimestamp() == null)
setEntryTimestamp(new NSTimestamp());
if (myValue() == null)
setMyValue(new Integer(0));
}
You will need to have this method on both the server and client side
classes. This opens up a whole other "can-of-worms" when you want to
use code generators like those built into EOModeler or EOGenerator.
Here are the Apple Design Recommendations:
http://developer.apple.com/documentation/WebObjects/
DesktopApplications/DistributionLayer/chapter_6_section_2.html#//
apple_ref/doc/uid/TP30001017-CH302-TPXREF32
I don't see any way to use code generators while following this
design recommendation. So you're either suck with one of three options:
1. Use a single class file for both the server-side and client-side.
No code duplication with this option.
2. Use a code generator and duplicate all your logic on both server-
side and client-side as described above.
3. Use Apple's Design Recommendation. No code duplication. Business
logic partitioning protects code. Some hand coding of business logic
required.
Possible option 4. I don't claim to know everything and someone else
on the list may have know a solution that makes all this stuff work.
On Oct 3, 2005, at 6:28 AM, Jarvis Cochrane wrote:
Hello,
I'm trying to get my head around Direct to Java Client...
I've created a Framework to contain my EOModel and classes and
associated logic. I would like to create a direct to java client as
a separate project, which references the framework.
I'm trying to factor my "business logic" out into a framework that
doesn't need to know anything about direct to java or web pages or
any of that stuff!
Initially things worked ok - the d2jc application would allow me to
create data records, and perform searches, and so on.
The next step was to add an awakeFromInsertion() method on one of
the classes in my framework to supply default values for
properties. This doesn't appear to be being invoked on the client
(no default values), but is invoked on the server when the client
saves the data record (which means that it changes the value that
user has entered!).
I've tried reading Apple's documentation, but I can't make head nor
tail of it - at least where this issue is concerned.
So... How do you set up a d2jc project / application to say "use
the model and classes from this framework", and "use the server
side method in preference to a local method"?
Hoping someone can help,
jarvis
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden