Re: modeling problem
Re: modeling problem
- Subject: Re: modeling problem
- From: TW <email@hidden>
- Date: Mon, 30 Mar 2009 16:29:52 -0700
Begin forwarded message:
On Mar 30, 2009, at 3:51 PM, Chuck Hill wrote:
On Mar 30, 2009, at 3:05 PM, TW wrote:
On Mar 30, 2009, at 2:16 PM, Chuck Hill wrote:
On Mar 30, 2009, at 1:58 PM, TW wrote:
Thanks Chuck:
On Mar 30, 2009, at 1:18 PM, Chuck Hill wrote:
On Mar 29, 2009, at 4:48 PM, TW wrote:
All:
I have a model of our ldap directory with InetOrgPerson the
base "user" entity. I've made InetOrgPerson abstract with it's
table inetOrgPerson. I have the framework project containing
that model in the build path of another that I'm using as a
"generic user" framework.
In that second framework I have another model with a
"GenericUser" entity. That entity has "InetOrgPerson" as it's
parent. I've added this second framework to my app build path.
- in Entity Modeler if I set the table for "GenericUser" to
"inetOrgPerson" (the same as it's parent), my app fetches 2
identical GenericUser EO's for each 1 matching record in LDAP
That is because you have set up Single Table Inheritance BUT not
added any restricting qualifier on either entity. Are you
certain that InetOrgPerson is marked as abstract? Check it
again...
InetOrgPerson is definitely checked "Abstract" in my OD model.
I have never tried this without a restricting qualifier on one of
them.
You could try adding a restricting qualifier of (1 = 0) on
InetOrgPerson.
I didn't think I needed a restricting qualifier if the parent was
abstract. I do get errors requiring a restricting qualifier if
InetOrgPerson is _not_ abstract.
This sounds like a bug to me right now, please* bugreport.apple.com
My goal was to have an entity/class (where InetOrgPerson is
super) in a "middle" framework that can be used to wrap a
relationship between ldap user and database employee (each
modeled in their own frameworks). So, the way I have it set up
there's really no difference between InetOrgPerson and
GenericUser except that GenericUser has the relationship to
<database employee> and InetOrgPerson does not.
I still wonder if GenericUser should have a relationship to both
InetOrgPerson and DatabaseEmployee.
With that approach, it sounds like GenericUser would have to have
it's own data table separate from the other two?
Doesn't it need to anyway for the relationship to DatabaseEmployee?
Not really. Time for ascii sheep. This is what I have.
LDAPModel ---to build path--> UserModel <--to build path---- DBModel
======== ========= ================
InetOrgPerson GenericUser <-------------> Employee
(InetOrgPerson/parent)
The only relationship (on the right) uses "employee_id." This approach
makes the ldap side of things the starting point since that is the
store that knows what type of user the person is. If ldap
authentication is successful, I query for the matching GenericUser
which is essentially an ldap person since GenericUser inherits from
InetOrgPerson. Then, I can test for the related employee record. If
there, foo, if not, bar - depends on the app.
It sounds like your preferred approach would be to create another
table for GenericUser making it a database entity instead of
inheriting from InetOrgPerson. That could work too. The problem there
is then I have two entities, InetOrgPerson and GenericUser that have
to have similar attributes, including "usertype," "email," etc. And,
when a new Employee is created, I'd have to force the creation of a
GenericUser.
I can see advantages each way and it's too bad I'm somewhat at the
mercy of the greater campus.
T
I'm trying to abstract everything so that I can pick and choose
what gets used on a per app basis.
- if I change the table for "GenericUser to "GenericUser" it
works as expected. However, there is no such "table" or object
in my LDAP directory. And I'm concerned that with that setup
attempts to write to the directory would fail.
It should be OK like that. That is Vertical Inheritance which
may have its own issues.
Well, I'm willing to tackle those issues when I encounter them if
this should work. Fetches are currently working if I leave it as
is and I'm not currently using any WO apps to create GenericUser
or InetOrgPerson EO's.
Careful, that VI stuff can be dodgy.
Chuck
The first way seems that it should be the proper way to do it
but I don't understand why I'm getting two EO's for each
record. Can someone point me to what I'm being dumb about?
I am not sure that the first way is correct. What if you then
add data to GenericUser? It sort of feels like InetOrgPerson
ought to be relationship from GenericUser, not the parent.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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