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

Are you using a secondary cache? Have you cleared it? Have you restarted CF?



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform:

I am using the secondary cache, and the entity creating the foul is using read-write.

However, I was under the impression that an ORMReload() would evict all items from the cache.

I should have mentioned also that the ORMReload() is a part of a full app reload that I do as part of deployment.

I have not restarted CF…would like to avoid that if possible, but will if that will resolve the issue for good.


When using secondary cache then use EntityMerge which will make sure most up-to-date copy in orm cache/session.


Ok, am able to reproduce this in my dev environment. Here are the steps:

  • Create record in app (via ORM)
  • Manually update record in SQL (Change the PersonID in the Stuff table for the record)
  • Restart ColdFusion
  • Load app and run criteria query
  • OrmReload()
  • Restart ColdFusion
  • and on and on
    So it appears that ORMReload() is fixing the issue, as I experienced on my production site. However, I’m thoroughly confused about what’s happening with the CF restarts. I’m not privy to when our CF instances are restarted on production, so I’m not entirely sure this is the root of the issue. However, being able to reproduce the issue consistently on dev has given a glimmer of hope to my weary soul.

Can anyone explain this to my poor brain? :slight_smile:


Are you using secondary cache?

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:


(He answered that in the affirmative a few hours ago. :slight_smile:

Some helpful docs, for dealing with data-changes


Optimistic locking

I have seen that behavior with cache enabled. I would try to do distinct cache regions and also manual cache evictions.

Thanks for the suggestions guys. I guess what I’m confused about is why the cache evictions would be needed after a CF restart. Wouldn’t the cache be re-established in that scenario?