RE: [coldbox:18404] [coldbox-3.5.3] Weird ORM Issue [loaded object was of wrong class]

It depends-- what cache provider are you using?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I’m using ehCache, vanilla config.

In my development environment, I’ve tried evicting the entity, as well as all queries. No change. If I ORMReload(), the problem is resolved. However, the moment I restart CF, the error comes back (for the exact same entities).

I am clearly missing something, but I have no idea what. Is there a way to simply bomb the entire cache and start over?

Thanks

I ser you have two personid is that normal

Those are just the PK and FK in my tables

They have the same name?

Yes, they do.

Alright, here are my findings (thin and disappointing as they are).

  • Whenever I do a CF restart, the issue appears

  • When I subsequently ormReload(), the issue is resolved

  • When I subsequently restart CF, the issue reappears
    I thought this was a caching issue at first, but now I’m not so sure. In my flailing to find an answer, I went back to my original query:

c = StuffService.newCriteria(); c.createAlias( 'Person', 'p' ).isEq( 'p.PersonID', someid ).list()

Instead of creating an alias, I simply used a SQL restriction:

c = StuffService.newCriteria(); c.sqlRestriction( "PersonID= '#arguments.criteria[ crit ]#'" ).list();

After switching to this, everything seems to work as expected, without the drama of ormReload() vs. CF restart.

I’m still not sure why the former criteria query caused that error, but I suspect that perhaps it has something to do with the relationships that exist between Person and other entities through the app. Maybe something down the line in the relationship chain got some wires crossed…who knows.

Anyway, that’s my workaround for now. I’d like to understand fully what was happening, but deadlines are calling my name :slight_smile:

Weird!

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano