Re: Interfaces and Java Client
Re: Interfaces and Java Client
- Subject: Re: Interfaces and Java Client
- From: David Avendasora <email@hidden>
- Date: Wed, 26 Apr 2006 09:30:48 +0100
Here is some more detail after some substantial work on this:
I think it all comes down to that EOModeler and Direct to Java Client
(and probably Direct to Web) cannot handle interfaces. (Please tell
me I'm wrong!) If the actual code does not agree with the .eomodeld
package, then it causes all sorts of weirdness.
I originally had Entities in EOModeler for each interface, that way I
could set relationships to them, configure their attributes and
relationships, etc all within EOModeler. This worked GREAT for the
ability to generate java files automatically with EOGenerator and a
few custom templates that both created interfaces and implemented
them and it compiled beautifully.
The problem was the application would not work if the generated
interface and implementing class files were built in the Web Server
target (as they are supposed to be in a D2JC application). It worked
fine if they were built in the Application Server target but then
other custom code broke. I still don't understand why they worked in
the wrong target, but whatever the case, it was not a workable solution.
I made substantial progress by removing the interface entities from
the EOModel and remapping the relationships from the interface
entities to the entities that were previously implementing the
interfaces. For example:
Interfaces: Label toOne IHasLabel
No interfaces: Label toOne Part
But this won't work unless Label's class is EOGenericRecord because
"Part" is, in fact, an abstract class and can't be instantiated yet
my eomodeld package IS telling it to. This is one of my reasons for
using an interface in the first place. That along with the fact that
Part is the Superclass to 3 other classes, only two of which would
ever have a label, so having the relationship to Part is not an
accurate design anyway! These two subclasses implemented the
IHasLabel interface.
I've tried manually modifying the .plist files within the .eomodeld
package so the relationships are set properly, but That generates a
"java.lang.IllegalStateException: Server exception: EORelationship():
cannot find entity named IHasLabels for destination of relationship
part in entity Label." exception in the console.
Can anyone give me insight into proper use of interfaces in a Direct
To Web/Java Client context??
Thanks,
Dave
On Apr 25, 2006, at 2:34 PM, Robert Walker wrote:
David,
Are you adding your interfaces to both the "Application Server" and
"Web Server" targets? I've not tried this myself, but if your
interfaces are in the "Application Server" target only, then that
may be why they don't work on the client-side. I know this is a
simple thing and you are probably already do this, but I thought I
would mention it just in case.
On Apr 25, 2006, at 4:55 AM, David Avendasora wrote:
Hi all,
I'm working on a Java Client project. I am trying to implement
interfaces instead of inheritance in several places, but I'm
running into a problem.
I'm using XCode for development and if the client-side classes are
built in the Web Server target as they are supposed to be
according to the Apple WO Java Client documentation, the
interfaces don't work. The proper SQL is executed on the database,
but no objects ever show up in the client application. If I simply
change the target to Application Server, then everything works
exactly as would be expected.
Does anyone have any idea why interfaces built to the Web Server
target don't work?
Thanks!
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
--
Robert Walker
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:
40avendasora.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