empty optional to-many relations

Zak Burke <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
I have the following model:

	DLPerson <<--> DLEntity <-->> DLOrganization

On DLEntity, both the people and the organizations relations are
optional; on DLPerson and DLOrganization, the entity relation is
required. If I try to save changes to a DLEntity object that has people
but no organizations, EOF throws a NPE (details below).

It looks to me like EOF is trying to query to figure out what rows may
need to be updated, and it somehow chokes on the empty orgs
relationship, despite the fact that this relationship is empty. I tried
changing the join-type from inner to left-outer, but the SQL it
generated was non-standard and our DB barfed on the syntax.

I dunno if I have a problem with my model (either literally in the
"corrupt file" sense or figuratively in the "there's a better way to
model these relationships" sense) or some problem in my code of if there
is some vagary of EOF that I've run afoul of. I'll take advice or
assistance on any front.

Here are the details of what I see after calling ec.saveChanges()

SELECT t0.entity_id, t0.person_id
FROM dl_person t0
WHERE t0.entity_id = ?" withBindings: 1:1937(entityId)

DEBUG [2006-08-14 13:58:39,169] (LogPrintStream.java:96) - 1 row(s)
processed

SELECT t0.entity_id, t0.organization_id, t0.parent_id, t0.superordinate_id
FROM dl_organization t0
WHERE t0.entity_id = ?" withBindings: 1:1937(entityId)

DEBUG [2006-08-14 13:58:39,257] (LogPrintStream.java:96) -  0 row(s)
processed

<com.webobjects.appserver._private.WOComponentRequestHandler>: Exception
occurred while handling request:
java.lang.NullPointerException
DEBUG [2006-08-14 13:58:39,270] (LogPrintStream.java:96) -
java.lang.NullPointerException
at
com.webobjects.jdbcadaptor.JDBCAdaptor.isValidQualifierType(JDBCAdaptor.java:659)
at
com.webobjects.eoaccess.EODatabaseContext.isValidQualifierTypeForAttribute(EODatabaseContext.java:5174)
at
com.webobjects.eoaccess.EODatabaseContext.lockingNonQualifiableAttributes(EODatabaseContext.java:5188)
at
com.webobjects.eoaccess.EODatabaseContext.createAdaptorOperationsForDatabaseOperationAttributes(EODatabaseContext.java:5374)
at
com.webobjects.eoaccess.EODatabaseContext.createAdaptorOperationsForDatabaseOperation(EODatabaseContext.java:5548)
at
com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6365)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:415)
at
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3226)
at
org.thei3p.eocontrol.I3pkbEditingContext.saveChanges(I3pkbEditingContext.java:147)

TIA,

zak.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.