Hi Andrus,

Nop every row in the database (and thats about 180K rows) is from one type or another. I am trying to find out why it has those relations and what entities are being cascaded into the delete, just in case I have the model misconfigured.

Ramiro

El 03/01/2013 19:16, Andrus Adamchik escribió:
Hi Ramiro,

Happy New Year to you too :)

So is it possible that the database row that causes this exception does not map 
to any concrete subclass entity qualifier?

Andrus


On Jan 3, 2013, at 8:54 PM, Ramiro Aparicio <ramiro.apari...@prot-on.com> wrote:

Hi and happy new year to everyone,

I am back with my happy inheritance one more time.
I am using single table inheritance and just in case someone did not remember 
the model here is a simplification about it:

abstract SessionLog it has relations to other tables as Log or User
SessionLogApi and SessionLogWeb that inherits from SessionLog they have 
specific information about the session type and their own relations

I have found some problems with this kind of mapping but till now I have always 
find a way to hack around Cayenne problems with this and today (we are really 
near to put the new version with inheritance in production) I have struck 
against this exception:

Caused by: org.apache.cayenne.CayenneRuntimeException: [v.3.1B1 May 28 2012 
18:42:43] Error creating object of class 'com.proton.ks.persistence.SessionLog'
at 
org.apache.cayenne.reflect.PersistentDescriptor.createObject(PersistentDescriptor.java:288)
at 
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.createObject(LazyClassDescriptorDecorator.java:73)
at 
org.apache.cayenne.access.DataContext.findOrCreateObject(DataContext.java:1178)
at 
org.apache.cayenne.access.ObjectResolver.objectFromDataRow(ObjectResolver.java:151)
at 
org.apache.cayenne.access.ObjectResolver.objectFromDataRow(ObjectResolver.java:137)
at 
org.apache.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:121)
at 
org.apache.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:102)
at 
org.apache.cayenne.access.ObjectResolver.synchronizedRootResultNodeFromDataRows(ObjectResolver.java:93)
at 
org.apache.cayenne.access.DataDomainQueryAction$ObjectConversionStrategy.toResultsTree(DataDomainQueryAction.java:581)
at 
org.apache.cayenne.access.DataDomainQueryAction$SingleObjectConversionStrategy.convert(DataDomainQueryAction.java:637)
at 
org.apache.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:465)
at 
org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:129)
at org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:754)
at 
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:1003)
at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:744)
at 
org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:350)
at 
org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:106)
at 
org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:93)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:989)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:978)
at 
org.apache.cayenne.util.RelationshipFault.resolveFromDB(RelationshipFault.java:89)
at 
org.apache.cayenne.util.PersistentObjectList.resolvedObjectList(PersistentObjectList.java:301)
at 
org.apache.cayenne.util.PersistentObjectList.toArray(PersistentObjectList.java:278)
at java.util.ArrayList.(ArrayList.java:131)
at 
org.apache.cayenne.ObjectContextDeleteAction.toCollection(ObjectContextDeleteAction.java:124)
at 
org.apache.cayenne.ObjectContextDeleteAction.processDeleteRules(ObjectContextDeleteAction.java:153)
at 
org.apache.cayenne.ObjectContextDeleteAction.deletePersistent(ObjectContextDeleteAction.java:112)
at 
org.apache.cayenne.ObjectContextDeleteAction.performDelete(ObjectContextDeleteAction.java:91)
at org.apache.cayenne.BaseContext.deleteObjects(BaseContext.java:698)
at 
com.proton.cayenne.utils.CayenneTemplate.deleteObject(CayenneTemplate.java:79)
at 
com.proton.ks.services.business.HostingService.rejectUserRequestToDomain(SourceFile:413)
... 120 more
Caused by: java.lang.InstantiationException
at 
sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at 
org.apache.cayenne.reflect.PersistentDescriptor.createObject(PersistentDescriptor.java:285)
... 150 more

In case it is not clear in the trace I am only doing a 
context.deleteObjects(user) that user is cascading throught the model and in 
some way hitting a SessionLogApi or SessionLogWeb which Cayenne treats as a 
standard SessionLog and fails.

I hope Andrus can help with this, at least with a way to circunvent the error 
as the fix, if feasible, will take some time to arrive a Cayenne release 
version.

As always just ask for model, tests, or whatever as I am happy to provide them.

Thank you in advance and merry christmas


Reply via email to