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?

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 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.

Hi,

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

Thanks

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
  • ERROR OCCURS
  • OrmReload()
  • ERROR RESOLVED
  • Restart ColdFusion
  • ERROR OCCURS
  • 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:

Thanks

Are you using secondary cache?

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

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

Some helpful docs, for dealing with data-changes

Versioning
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSB7BEC0B4-8096-498d-8F9B-77C88878AC6C.html

Optimistic locking

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS2F0C1CDB-4CAF-42fd-B7D9-500D82C0136A.html

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?