Re: Using composition instead of inheritance

2012-06-02 Thread Mike Schrag
You'll have to dig into what that NPE is exactly. Hard to diagnose without that.

Sent from my iPhone

On Jun 2, 2012, at 1:52 AM, Paul Hoadley pa...@logicsquad.net wrote:

 Hi Mike,
 
 On 01/06/2012, at 10:54 PM, Mike Schrag wrote:
 
 I'm a little concerned about inverse relationships to FrameworkPerson when 
 you toss it  this might require more surgery than this.
 
 This is what I'm doing:
 
   @Override 
   public void didFinishLaunching() {
   super.didFinishLaunching();
   EOModel fmkModel = 
 EOModelGroup.defaultGroup().modelNamed(Auth);
   EOModel appModel = 
 EOModelGroup.defaultGroup().modelNamed(Survey);
   EOEntity fmkEntity = fmkModel.entityNamed(Organisation);
   fmkModel.removeEntity(fmkEntity);
   EOEntity appEntity = appModel.entityNamed(SSOrganisation);
   appEntity.setName(Organisation);
   return;
   }
 
 It looked like it might be working until I threw that into a D2W front-end 
 with the same models and database.  Just after login, as it builds the 
 ERMODQueryEntitiesPage, I get this:
 
 NullPointerException
   at 
 com.webobjects.eoaccess.EODatabase.addModelIfCompatible(EODatabase.java:575)
  ... skipped 15 stack elements
   at 
 com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
   at 
 com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
   at er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1215)
   at 
 com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:)
   at 
 net.logicsquad.webobjects.auth.model.auth._Person.fetchPersons(_Person.java:442)
   at 
 net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:436)
   at 
 net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:432)
   at 
 net.logicsquad.survstar.DirectAction.canUseBootstrapCredentials(DirectAction.java:108)
   at net.logicsquad.survstar.DirectAction.loginAction(DirectAction.java:143)
  ... skipped 4 stack elements
   at 
 com.webobjects.appserver.WODirectAction.performActionNamed(WODirectAction.java:144)
   at 
 er.extensions.appserver.ERXDirectAction.performActionNamed(ERXDirectAction.java:401)
   at 
 er.directtoweb.ERD2WDirectAction.performActionNamed(ERD2WDirectAction.java:463)
   ... skipped 9 stack elements
 
 Any thoughts on the appropriate additional surgery?
 
 
 -- 
 Paul Hoadley
 http://logicsquad.net/
 
 
 
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-02 Thread Paul Hoadley
On 02/06/2012, at 11:11 PM, Mike Schrag wrote:

 You'll have to dig into what that NPE is exactly. Hard to diagnose without 
 that.

Here's the full stack trace.

java.lang.NullPointerException
at 
com.webobjects.eoaccess.EODatabase.addModelIfCompatible(EODatabase.java:575)
at 
com.webobjects.eoaccess.EODatabaseContext.registeredDatabaseContextForModel(EODatabaseContext.java:1003)
at 
com.webobjects.eoaccess.EODatabaseContext.registeredDatabaseContextForModel(EODatabaseContext.java:1033)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects.foundation.NSSelector.invoke(NSSelector.java:358)
at 
com.webobjects.foundation.NSSelector._safeInvokeSelector(NSSelector.java:110)
at 
com.webobjects.eoaccess.EODatabaseChannel.setEntity(EODatabaseChannel.java:131)
at 
com.webobjects.eoaccess.EODatabaseChannel.setCurrentEntity(EODatabaseChannel.java:160)
at 
com.webobjects.eoaccess.EODatabaseChannel._setCurrentEntityAndRelationshipWithFetchSpecification(EODatabaseChannel.java:740)
at 
com.webobjects.eoaccess.EODatabaseChannel._selectWithFetchSpecificationEditingContext(EODatabaseChannel.java:808)
at 
com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecification(EODatabaseChannel.java:234)
at 
com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3055)
at 
com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195)
at 
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
at 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
at 
er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1215)
at 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:)
at 
net.logicsquad.webobjects.auth.model.auth._Person.fetchPersons(_Person.java:442)
at 
net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:436)
at 
net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:432)
at 
net.logicsquad.survstar.DirectAction.canUseBootstrapCredentials(DirectAction.java:109)
at 
net.logicsquad.survstar.DirectAction.loginAction(DirectAction.java:150)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
com.webobjects.appserver.WODirectAction.performActionNamed(WODirectAction.java:144)
at 
er.extensions.appserver.ERXDirectAction.performActionNamed(ERXDirectAction.java:401)
at 
er.directtoweb.ERD2WDirectAction.performActionNamed(ERD2WDirectAction.java:463)
at 
com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:259)
at 
com.webobjects.appserver._private.WOActionRequestHandler.handleRequest(WOActionRequestHandler.java:161)
at 
er.extensions.appserver.ERXDirectActionRequestHandler.handleRequest(ERXDirectActionRequestHandler.java:126)
at 
com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
at 
er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:2029)
at 
er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1994)
at 
com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
at java.lang.Thread.run(Thread.java:680)

At DirectAction.loginAction(), there's a call to Person.fetchAllPersons().  
Person is in the same framework model as Organisation, and it has a to-one 
relationship to Organisation.  This is after I've removed the Organisation 
entity from the framework model and changed the name of the application entity 
to Organisation.  Have I broken the framework model?


-- 
Paul Hoadley
http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-02 Thread Mike Schrag
Not sure ... you might want to change the class name on your framework entity, 
and copy the attributes and relationships from the app entity into the 
framework entity (rather than delete entities). you'll have to debug what is 
busted .. just printing out all your entites, relationships, and their 
destination entities ... something will be null. you'll have to look into 
EODatabase to see what exactly is NPEing.

On Jun 2, 2012, at 7:01 PM, Paul Hoadley pa...@logicsquad.net wrote:

 On 02/06/2012, at 11:11 PM, Mike Schrag wrote:
 
 You'll have to dig into what that NPE is exactly. Hard to diagnose without 
 that.
 
 Here's the full stack trace.
 
 java.lang.NullPointerException
   at 
 com.webobjects.eoaccess.EODatabase.addModelIfCompatible(EODatabase.java:575)
   at 
 com.webobjects.eoaccess.EODatabaseContext.registeredDatabaseContextForModel(EODatabaseContext.java:1003)
   at 
 com.webobjects.eoaccess.EODatabaseContext.registeredDatabaseContextForModel(EODatabaseContext.java:1033)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.webobjects.foundation.NSSelector.invoke(NSSelector.java:358)
   at 
 com.webobjects.foundation.NSSelector._safeInvokeSelector(NSSelector.java:110)
   at 
 com.webobjects.eoaccess.EODatabaseChannel.setEntity(EODatabaseChannel.java:131)
   at 
 com.webobjects.eoaccess.EODatabaseChannel.setCurrentEntity(EODatabaseChannel.java:160)
   at 
 com.webobjects.eoaccess.EODatabaseChannel._setCurrentEntityAndRelationshipWithFetchSpecification(EODatabaseChannel.java:740)
   at 
 com.webobjects.eoaccess.EODatabaseChannel._selectWithFetchSpecificationEditingContext(EODatabaseChannel.java:808)
   at 
 com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecification(EODatabaseChannel.java:234)
   at 
 com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3055)
   at 
 com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195)
   at 
 com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
   at 
 com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
   at 
 er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1215)
   at 
 com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:)
   at 
 net.logicsquad.webobjects.auth.model.auth._Person.fetchPersons(_Person.java:442)
   at 
 net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:436)
   at 
 net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:432)
   at 
 net.logicsquad.survstar.DirectAction.canUseBootstrapCredentials(DirectAction.java:109)
   at 
 net.logicsquad.survstar.DirectAction.loginAction(DirectAction.java:150)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at 
 com.webobjects.appserver.WODirectAction.performActionNamed(WODirectAction.java:144)
   at 
 er.extensions.appserver.ERXDirectAction.performActionNamed(ERXDirectAction.java:401)
   at 
 er.directtoweb.ERD2WDirectAction.performActionNamed(ERD2WDirectAction.java:463)
   at 
 com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:259)
   at 
 com.webobjects.appserver._private.WOActionRequestHandler.handleRequest(WOActionRequestHandler.java:161)
   at 
 er.extensions.appserver.ERXDirectActionRequestHandler.handleRequest(ERXDirectActionRequestHandler.java:126)
   at 
 com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
   at 
 er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:2029)
   at 
 er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1994)
   at 
 com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
   at 
 com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
   at java.lang.Thread.run(Thread.java:680)
 
 At DirectAction.loginAction(), there's a call to Person.fetchAllPersons().  
 Person is in the same framework model as Organisation, and it has a to-one 
 relationship to Organisation.  This is after I've removed the Organisation 
 entity from the framework model and changed the name of the application 
 

Re: Using composition instead of inheritance

2012-06-02 Thread Paul Hoadley
On 03/06/2012, at 8:59 AM, Mike Schrag wrote:

 Not sure ... you might want to change the class name on your framework 
 entity, and copy the attributes and relationships from the app entity into 
 the framework entity (rather than delete entities).

This is looking promising.  Changing the class name (without copying the 
additional attributes) allows me to display existing objects.  Just quickly: is 
there an easy way to clone an EOAttribute from the application model entity for 
adding to the framework model entity?


-- 
Paul Hoadley
http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-02 Thread Mike Schrag
Not . Sure ... Maybe can you spit out the plist of the orig and construct a 
new one with that plist?

Sent from my iPad

On Jun 2, 2012, at 8:09 PM, Paul Hoadley pa...@logicsquad.net wrote:

 On 03/06/2012, at 8:59 AM, Mike Schrag wrote:
 
 Not sure ... you might want to change the class name on your framework 
 entity, and copy the attributes and relationships from the app entity into 
 the framework entity (rather than delete entities).
 
 This is looking promising.  Changing the class name (without copying the 
 additional attributes) allows me to display existing objects.  Just quickly: 
 is there an easy way to clone an EOAttribute from the application model 
 entity for adding to the framework model entity?
 
 
 -- 
 Paul Hoadley
 http://logicsquad.net/
 
 
 
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-02 Thread Paul Hoadley
On 03/06/2012, at 12:02 PM, Mike Schrag wrote:

 Not . Sure ... Maybe can you spit out the plist of the orig and construct 
 a new one with that plist?

Thanks for the idea.

I pressed on for a bit after creating the attribute manually, and it mostly 
looked good until saving a new object, at which point I hit a duplicate primary 
key issue, presumably because the framework entity was still using the sequence 
originally created for it rather than the sequence for the app entity...  (I 
had already created an AppEntity directly in code at first startup, and now D2W 
was going to create an AppEntity that it thought was a FrameworkEntity.)

I'm sure I could get there eventually, but it's starting to seem very 
complicated.  I think I'll just revert to adding an attribute to the framework 
entity at runtime.


-- 
Paul Hoadley
http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-01 Thread Paul Hoadley
Hi Mike,

On 30/05/2012, at 8:01 AM, Mike Schrag wrote:

 When your models load, replace FrameworkPerson entity with AppPerson entity, 
 so fetches for FrameworkPerson are secretly the equivalent to what AppPerson 
 fetches would be.


Is this just a matter of calling removeEntity() and then addEntity() on the 
EOModel, or is there more that needs to be done?


-- 
Paul Hoadley
http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-01 Thread Paul Hoadley
On 01/06/2012, at 10:26 PM, Mike Schrag wrote:

 Remove FrameworkPerson entity, then rename AppPerson to be FrameworkPerson.

Just model.removeEntity(frameworkPerson) and 
appPerson.setName(FrameworkPerson.ENTITY_NAME)?  Thanks Mike.


-- 
Paul.

http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-01 Thread Mike Schrag
... only one way to find out :)

On Jun 1, 2012, at 9:13 AM, Paul Hoadley pa...@logicsquad.net wrote:

 On 01/06/2012, at 10:26 PM, Mike Schrag wrote:
 
 Remove FrameworkPerson entity, then rename AppPerson to be FrameworkPerson.
 
 Just model.removeEntity(frameworkPerson) and 
 appPerson.setName(FrameworkPerson.ENTITY_NAME)?  Thanks Mike.
 
 
 -- 
 Paul.
 
 http://logicsquad.net/
 
 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-01 Thread Mike Schrag
I'm a little concerned about inverse relationships to FrameworkPerson when you 
toss it  this might require more surgery than this.

On Jun 1, 2012, at 9:13 AM, Paul Hoadley pa...@logicsquad.net wrote:

 On 01/06/2012, at 10:26 PM, Mike Schrag wrote:
 
 Remove FrameworkPerson entity, then rename AppPerson to be FrameworkPerson.
 
 Just model.removeEntity(frameworkPerson) and 
 appPerson.setName(FrameworkPerson.ENTITY_NAME)?  Thanks Mike.
 
 
 -- 
 Paul.
 
 http://logicsquad.net/
 
 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-01 Thread Paul Hoadley
On 01/06/2012, at 10:54 PM, Mike Schrag wrote:

 I'm a little concerned about inverse relationships to FrameworkPerson when 
 you toss it  this might require more surgery than this.

I'll try it out over the weekend and see if anything explodes.


-- 
Paul.

http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-06-01 Thread Paul Hoadley
Hi Mike,

On 01/06/2012, at 10:54 PM, Mike Schrag wrote:

 I'm a little concerned about inverse relationships to FrameworkPerson when 
 you toss it  this might require more surgery than this.

This is what I'm doing:

@Override 
public void didFinishLaunching() {
super.didFinishLaunching();
EOModel fmkModel = 
EOModelGroup.defaultGroup().modelNamed(Auth);
EOModel appModel = 
EOModelGroup.defaultGroup().modelNamed(Survey);
EOEntity fmkEntity = fmkModel.entityNamed(Organisation);
fmkModel.removeEntity(fmkEntity);
EOEntity appEntity = appModel.entityNamed(SSOrganisation);
appEntity.setName(Organisation);
return;
}

It looked like it might be working until I threw that into a D2W front-end with 
the same models and database.  Just after login, as it builds the 
ERMODQueryEntitiesPage, I get this:

NullPointerException
  at 
com.webobjects.eoaccess.EODatabase.addModelIfCompatible(EODatabase.java:575)
 ... skipped 15 stack elements
  at 
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
  at 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
  at er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1215)
  at 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:)
  at 
net.logicsquad.webobjects.auth.model.auth._Person.fetchPersons(_Person.java:442)
  at 
net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:436)
  at 
net.logicsquad.webobjects.auth.model.auth._Person.fetchAllPersons(_Person.java:432)
  at 
net.logicsquad.survstar.DirectAction.canUseBootstrapCredentials(DirectAction.java:108)
  at net.logicsquad.survstar.DirectAction.loginAction(DirectAction.java:143)
 ... skipped 4 stack elements
  at 
com.webobjects.appserver.WODirectAction.performActionNamed(WODirectAction.java:144)
  at 
er.extensions.appserver.ERXDirectAction.performActionNamed(ERXDirectAction.java:401)
  at 
er.directtoweb.ERD2WDirectAction.performActionNamed(ERD2WDirectAction.java:463)
  ... skipped 9 stack elements

Any thoughts on the appropriate additional surgery?


-- 
Paul Hoadley
http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Ken Anderson
Paul,

My first question would be - how do you actually benefit from having this data 
separated?  Is there a reason that you don't just create a new entity for the 
new project that can represent the entire organization?

If the reason is that you have code that you would typically use in more than 
one project, I would consider building that into POJOs .  In general, I find 
that the benefits of splitting up entities (either through inheritance OR 
composition) seldom outweighs the benefits of having them together, unless 
there are some circumstances that totally warrant it.  If you could provide 
more information on the perceived benefits, people might be able to help you 
better.

Ken

On May 29, 2012, at 1:16 AM, Paul Hoadley wrote:

 Hello,
 
 I'm after some general modelling advice.  I've been using inheritance for 
 years to model app-specific versions of a framework-level Person (user) 
 entity.  This works well enough, though it presents the same small headaches 
 time after time for each new application.
 
 I also have a framework-level Organisation entity to model a user's 
 organisation.  I need to customise this for a new application, and I thought 
 this time I would use composition instead of inheritance—I'll create a new 
 FooOrganisation entity which has a to-one relationship to Organisation 
 (without the inverse relationship), and then the additional attributes and/or 
 relationships which are app-specific.
 
 The application is still in development, but there's a demo deployment, and 
 while I _can_ wipe the database, there are existing Organisation EOs in it, 
 and it would be nice if I didn't have to.  I'm using migrations, so I can 
 perform any one-off fix-ups in a post-migration step.
 
 So, do people model like this?  Are there any pitfalls?  What's the best way 
 to ensure referential integrity, such that Organisation and FooOrganisation 
 remain 1-1—'owns destination' and 'propagates primary key'?  (Selecting those 
 will require I scrap the DB and create the FooOrganisations first, won't it?) 
  Would dynamically adding some properties to the model at runtime be a better 
 option here if I just want to store, say, a few limited extra attributes on 
 an entity?
 
 
 -- 
 Paul Hoadley
 http://logicsquad.net/
 
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/kenlists%40anderhome.com
 
 This email sent to kenli...@anderhome.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Mike Schrag
This is the problem that Partial Entities were attempting to solve ( 
http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/partials/package-summary.html
 ). I would consider it experimental, but if anyone wants to take it and finish 
it, go for it.

ms

On May 29, 2012, at 1:40 PM, Ken Anderson kenli...@anderhome.com wrote:

 Paul,
 
 My first question would be - how do you actually benefit from having this 
 data separated?  Is there a reason that you don't just create a new entity 
 for the new project that can represent the entire organization?
 
 If the reason is that you have code that you would typically use in more than 
 one project, I would consider building that into POJOs .  In general, I find 
 that the benefits of splitting up entities (either through inheritance OR 
 composition) seldom outweighs the benefits of having them together, unless 
 there are some circumstances that totally warrant it.  If you could provide 
 more information on the perceived benefits, people might be able to help you 
 better.
 
 Ken
 
 On May 29, 2012, at 1:16 AM, Paul Hoadley wrote:
 
 Hello,
 
 I'm after some general modelling advice.  I've been using inheritance for 
 years to model app-specific versions of a framework-level Person (user) 
 entity.  This works well enough, though it presents the same small headaches 
 time after time for each new application.
 
 I also have a framework-level Organisation entity to model a user's 
 organisation.  I need to customise this for a new application, and I thought 
 this time I would use composition instead of inheritance—I'll create a new 
 FooOrganisation entity which has a to-one relationship to Organisation 
 (without the inverse relationship), and then the additional attributes 
 and/or relationships which are app-specific.
 
 The application is still in development, but there's a demo deployment, and 
 while I _can_ wipe the database, there are existing Organisation EOs in it, 
 and it would be nice if I didn't have to.  I'm using migrations, so I can 
 perform any one-off fix-ups in a post-migration step.
 
 So, do people model like this?  Are there any pitfalls?  What's the best way 
 to ensure referential integrity, such that Organisation and FooOrganisation 
 remain 1-1—'owns destination' and 'propagates primary key'?  (Selecting 
 those will require I scrap the DB and create the FooOrganisations first, 
 won't it?)  Would dynamically adding some properties to the model at runtime 
 be a better option here if I just want to store, say, a few limited extra 
 attributes on an entity?
 
 
 -- 
 Paul Hoadley
 http://logicsquad.net/
 
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/kenlists%40anderhome.com
 
 This email sent to kenli...@anderhome.com
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
 
 This email sent to msch...@pobox.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Paul Hoadley
Hi Ken,

On 30/05/2012, at 3:10 AM, Ken Anderson wrote:

 My first question would be - how do you actually benefit from having this 
 data separated?

I don't.  It's just a side effect of wanting to have an app-specific EO based 
on a more general framework-level EO.

 Is there a reason that you don't just create a new entity for the new project 
 that can represent the entire organization?

Just code/entity reuse.  I already have a framework-level Organisation entity.  
It's just that different applications want to be able to hang different 
attributes and relationships off it.

 If the reason is that you have code that you would typically use in more than 
 one project, I would consider building that into POJOs .  In general, I find 
 that the benefits of splitting up entities (either through inheritance OR 
 composition) seldom outweighs the benefits of having them together, unless 
 there are some circumstances that totally warrant it.  If you could provide 
 more information on the perceived benefits, people might be able to help you 
 better.

It's basically the exact scenario described in the Javadocs for Mike Schrag's 
partial entities:

 A very common case where this becomes useful is that of a Person entity. 
 Person is an entity that is used in many different scenarios, each of which 
 requires additional attributes and relationships. For instance, you may have 
 a task management application and you want to embed your calendaring 
 framework into it. The common Person base entity may have username and 
 password attributes, the tasking application may add an activeTasks 
 relationship, and the calendaring framework may add a scheduledEvents 
 relationship as well as dayStartTime and dayEndTime attributes. Note that 
 partials are not designed to address the issue of roles, where different 
 people in the system may have different roles at different times. Partial 
 entities are designed to address the issue of combining high level modules 
 together to form more complex static entity declarations.


That's precisely the problem I'm trying to solve.  Until now I've done it via 
inheritance.  I was going to see if composition was any easier, but after 
diving into it, it seems to be about as hairy as inheritance, just in different 
places.  What I settled on was adding a new column to the Organisation table 
using a migration, and adding a matching attribute to the model at application 
startup.  Apart from not having the convenience of the Velocity template 
methods, it certainly seems to work fine.

I'm still interested to know what other people are doing, though.  Given the 
problem described by Mike above, how are people solving it?


-- 
Paul.

http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Mike Schrag
In the absence of the fancier solution (something like partial entities), I 
think I would make an app variant of the entity (where the class of the app one 
extends the class of the framework one) and model-rewrite the non-app variant 
to be the app variant.

ms

On May 29, 2012, at 6:22 PM, Paul Hoadley pa...@logicsquad.net wrote:

 Hi Ken,
 
 On 30/05/2012, at 3:10 AM, Ken Anderson wrote:
 
 My first question would be - how do you actually benefit from having this 
 data separated?
 
 I don't.  It's just a side effect of wanting to have an app-specific EO based 
 on a more general framework-level EO.
 
 Is there a reason that you don't just create a new entity for the new 
 project that can represent the entire organization?
 
 Just code/entity reuse.  I already have a framework-level Organisation 
 entity.  It's just that different applications want to be able to hang 
 different attributes and relationships off it.
 
 If the reason is that you have code that you would typically use in more 
 than one project, I would consider building that into POJOs .  In general, I 
 find that the benefits of splitting up entities (either through inheritance 
 OR composition) seldom outweighs the benefits of having them together, 
 unless there are some circumstances that totally warrant it.  If you could 
 provide more information on the perceived benefits, people might be able to 
 help you better.
 
 It's basically the exact scenario described in the Javadocs for Mike Schrag's 
 partial entities:
 
 A very common case where this becomes useful is that of a Person entity. 
 Person is an entity that is used in many different scenarios, each of which 
 requires additional attributes and relationships. For instance, you may have 
 a task management application and you want to embed your calendaring 
 framework into it. The common Person base entity may have username and 
 password attributes, the tasking application may add an activeTasks 
 relationship, and the calendaring framework may add a scheduledEvents 
 relationship as well as dayStartTime and dayEndTime attributes. Note 
 that partials are not designed to address the issue of roles, where 
 different people in the system may have different roles at different times. 
 Partial entities are designed to address the issue of combining high level 
 modules together to form more complex static entity declarations.
 
 
 That's precisely the problem I'm trying to solve.  Until now I've done it via 
 inheritance.  I was going to see if composition was any easier, but after 
 diving into it, it seems to be about as hairy as inheritance, just in 
 different places.  What I settled on was adding a new column to the 
 Organisation table using a migration, and adding a matching attribute to the 
 model at application startup.  Apart from not having the convenience of the 
 Velocity template methods, it certainly seems to work fine.
 
 I'm still interested to know what other people are doing, though.  Given the 
 problem described by Mike above, how are people solving it?
 
 
 -- 
 Paul.
 
 http://logicsquad.net/
 
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
 
 This email sent to msch...@pobox.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Paul Hoadley
On 30/05/2012, at 7:55 AM, Mike Schrag wrote:

 In the absence of the fancier solution (something like partial entities), I 
 think I would make an app variant of the entity (where the class of the app 
 one extends the class of the framework one) and model-rewrite the non-app 
 variant to be the app variant.

What do you mean by the last bit: model-rewrite the non-app variant to be the 
app variant?


-- 
Paul.

http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Mike Schrag
 This is the problem that Partial Entities were attempting to solve ( 
 http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/partials/package-summary.html
  ). I would consider it experimental, but if anyone wants to take it and 
 finish it, go for it.
 
 By experimental, is it closer to you would be crazy to use this right now 
 or this probably works?  Roughly what remains to be done?
Meaning i have no idea what state this is in. It basically worked for my test 
cases, but I never used it in real life. I have no idea if it has since been 
broken by later changes to wonder (this was years ago). Certainly a decent 
starting point if you wanted to try to ship something based on the concept.

ms
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Mike Schrag
FrameworkPerson (and all code in the framework refers to that) and AppPerson 
(extends FrameworkPerson class, and all app code refers to that). When your 
models load, replace FrameworkPerson entity with AppPerson entity, so fetches 
for FrameworkPerson are secretly the equivalent to what AppPerson fetches would 
be. This is assuming EVERY row in your person table is an AppPerson in any 
given app.

ms

On May 29, 2012, at 6:28 PM, Paul Hoadley pa...@logicsquad.net wrote:

 On 30/05/2012, at 7:55 AM, Mike Schrag wrote:
 
 In the absence of the fancier solution (something like partial entities), I 
 think I would make an app variant of the entity (where the class of the app 
 one extends the class of the framework one) and model-rewrite the non-app 
 variant to be the app variant.
 
 What do you mean by the last bit: model-rewrite the non-app variant to be 
 the app variant?
 
 
 -- 
 Paul.
 
 http://logicsquad.net/
 
 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using composition instead of inheritance

2012-05-29 Thread Paul Hoadley
On 30/05/2012, at 8:01 AM, Mike Schrag wrote:

 FrameworkPerson (and all code in the framework refers to that) and AppPerson 
 (extends FrameworkPerson class, and all app code refers to that). When your 
 models load, replace FrameworkPerson entity with AppPerson entity, so fetches 
 for FrameworkPerson are secretly the equivalent to what AppPerson fetches 
 would be. This is assuming EVERY row in your person table is an AppPerson in 
 any given app.

Thanks Mike.


-- 
Paul.

http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com