• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting up horizontal inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting up horizontal inheritance


  • Subject: Re: Setting up horizontal inheritance
  • From: Chuck Hill <email@hidden>
  • Date: Sun, 2 Nov 2008 21:29:11 -0800


On Nov 2, 2008, at 9:18 PM, Paul Hoadley wrote:

I'm sure I'm close to understanding this... thanks for bearing with me.

On 03/11/2008, at 1:19 PM, Ken Anderson wrote:

On Nov 1, 2008, at 10:51 PM, Paul Hoadley wrote:

I've implemented it using HI, and it seems to be working. I'm not convinced I have it quite right, though. There's another EO in the utility-framework's model, UserPreference. UserPreference has a to-one relationship with Person to denote the owner of the preference. In the particular app, though, I'm now using AMPersons, and hence the amperson table in the database---but UserPreference.person relationship obviously looks for a Person in the 'person' table, and there aren't any. To overcome this, I have sub-classed UserPreference to create AMUserPreference, with the only change being that the person relationship points to AMPerson. This seems inelegant to me---am I doing it right? (Or is this a candidate for the kind of dynamic model change you refer to above?)

This is why it would be better for Person to be abstract, and have different subentities for each application. That way, UserPreference could have a relationship to the abstract Person entity, which would automatically search all the subentities for the correct one for that particular primary key.

I've made Person abstract in the model. I've deleted the redundant EO (AMUserPreference), and UserPreference (which is in the same framework as Person) points to the abstract Person entity. I no longer generate a 'person' table, as I won't be instantiating Person.

That might be a bad idea. Some databases ( FrontBase) need this base table for PK generation.



Now, where the app would create a UserPreference, I get this on saving:

[2008-11-3 15:33:36 CST] <WorkerThread0> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
java.lang.NullPointerException
Application.handleException: Handling an Exception:
java.lang.NullPointerException
at com .webobjects .eoaccess .EODatabaseContext ._verifyNoChangesToReadonlyEntity(EODatabaseContext.java:4696)

That is often caused by having a FK marked as a class property. That is the first think that I would check.



at com .webobjects .eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java: 6183)
at com .webobjects .eocontrol .EOObjectStoreCoordinator .saveChangesInEditingContext(EOObjectStoreCoordinator.java:376)
at com .webobjects .eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3176)
at net .logicsquad .am .components .pages.UserPreferencesPage.saveButtonAction(UserPreferencesPage.java: 23)
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:585)
at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor $1.methodValue(NSKeyValueCoding.java:636)
at com.webobjects.foundation.NSKeyValueCoding $_MethodBinding.valueInObject(NSKeyValueCoding.java:1134)
at com.webobjects.foundation.NSKeyValueCoding $DefaultImplementation.valueForKey(NSKeyValueCoding.java:1293)
at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java: 1686)
at com.webobjects.foundation.NSKeyValueCoding $Utility.valueForKey(NSKeyValueCoding.java:447)
at com.webobjects.foundation.NSKeyValueCodingAdditions $ DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java: 212)
at net.logicsquad.am.AMComponent.valueForKeyPath(AMComponent.java: 153)
at com .webobjects .appserver ._private .WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:50)
at com .webobjects .appserver._private.WOSubmitButton.invokeAction(WOSubmitButton.java: 81)
at com .webobjects .appserver ._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com .webobjects .appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java: 115)
at com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:141)
at com .webobjects .appserver ._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com .webobjects .appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java: 115)
at com .webobjects .appserver ._private.WOComponentContent.invokeAction(WOComponentContent.java:38)
at com .webobjects .appserver ._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com .webobjects .appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java: 115)
at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java: 1078)
at com .webobjects .appserver ._private .WOComponentReference.invokeAction(WOComponentReference.java:127)
at com .webobjects .appserver ._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com .webobjects .appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java: 115)
at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java: 1078)
at com.webobjects.appserver.WOSession.invokeAction(WOSession.java: 1357)
at com .webobjects.appserver.WOApplication.invokeAction(WOApplication.java: 1736)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._dispatchWithPreparedPage(WOComponentRequestHandler.java:206)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._dispatchWithPreparedSession(WOComponentRequestHandler.java:298)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._handleRequest(WOComponentRequestHandler.java:369)
at com .webobjects .appserver ._private .WOComponentRequestHandler .handleRequest(WOComponentRequestHandler.java:442)
at com .webobjects .appserver.WOApplication.dispatchRequest(WOApplication.java:1678)
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:613)


I assume the "read only entity" is the newly-abstract Person. But I don't have any Person entities---I've made Person.java an abstract class.

I have some vague recollection that this can cause problems for EOF. It might only be in specific situations and I no longer recall any details. I have just avoided making abstract Java classes for EOs for years.




This is at a point where I'm trying to save a UserPreference whose 'person' relationship points to an AMPerson object.

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
  • Follow-Ups:
    • Re: Setting up horizontal inheritance
      • From: Ken Anderson <email@hidden>
    • Re: Setting up horizontal inheritance
      • From: Paul Hoadley <email@hidden>
References: 
 >Re: Setting up horizontal inheritance (From: Chuck Hill <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Ken Anderson <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Setting up horizontal inheritance
  • Next by Date: Re: Setting up horizontal inheritance
  • Previous by thread: Re: Setting up horizontal inheritance
  • Next by thread: Re: Setting up horizontal inheritance
  • Index(es):
    • Date
    • Thread