cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dougan Stuart <>
Subject Extended class issues
Date Wed, 13 Jul 2016 17:40:31 GMT
I have a class Company with a one-to-many relationship to other Companies (parentCompany <-
subCompanies). I’m able to set a Company’s parent when creating one, but upon update I’m
getting a NullPointerException in DefaultQuotingStrategy.quotedName because it’s been sent
a null attribute. Company extends the abstract class Entity; on the DB side Entity and Company
have a one-to-one relationship, and Entity has a parentEntity reference (which is modeled
as parentCompany). The obj-relationship parentCompany is set up with the target Company and
path parentEntity.

The null attribute is being added in org.apache.cayenne.access.DataDomainUpdateBucket.updatedAttributes.
The method is called first with the dbEntity Entity and the an updatedSnapshot containing
parentEntity, which is what I would expect. However, after this updatedAttributes is called
with Company and an updatedSnapshot containing parentEntity, so the following line


will return a null attribute when trying to get the name “parentEntity” off Company’s
attributes; that attribute only exists on Entity. I’d appreciate any help on preventing
it from trying to add invalid attributes.

I’m not sure if this is the root cause, but  DataDomainUpdateBucket.appendQueriesInternal
calls updatedAttributes based off the bucket’s dbEntities, which in this case are set in
DataDomainSyncBucket.groupObjEntitiesBySpannedDbEntities; this method is only adding Company
as a “secondary DbEntity” (as referred to in the comments) because Company has a flattened
attribute “name" that does not exist on the Entity.

Here’s the stack trace:

	at org.apache.cayenne.dba.DefaultQuotingStrategy.quotedName(
	at org.apache.cayenne.access.translator.batch.UpdateBatchTranslator.createSql(
	at org.apache.cayenne.access.translator.batch.DefaultBatchTranslator.ensureTranslated(
	at org.apache.cayenne.access.translator.batch.DefaultBatchTranslator.getSql(
	at org.apache.cayenne.access.jdbc.BatchAction.runAsBatch(
	at org.apache.cayenne.access.jdbc.BatchAction.performAction(
	at org.apache.cayenne.access.DataNodeQueryAction.runQuery(
	at org.apache.cayenne.access.DataNode.performQueries(
	at org.apache.cayenne.access.DataDomainFlushAction.runQueries(
	at org.apache.cayenne.access.DataDomainFlushAction.flush(
	at org.apache.cayenne.access.DataDomain.onSyncFlush(
	at org.apache.cayenne.access.DataDomain$2.transform(
	at org.apache.cayenne.access.DataDomain.runInTransaction(
	at org.apache.cayenne.access.DataDomain.onSyncNoFilters(
	at org.apache.cayenne.access.DataDomain$DataDomainSyncFilterChain.onSync(
	at org.apache.cayenne.access.DataDomain.onSync(
	at org.apache.cayenne.access.DataContext.flushToParent(
	at org.apache.cayenne.access.DataContext.commitChanges(


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message