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

In my app, I have a pretty generic relationship between two tables:



  • StuffID
  • Name
  • PersonID

  • Person- PersonID
  • Name

Based on this, I want to do a list():

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

This works fine…most of the time. The other day, however, I ran a script to update some PersonIDs on the Stuff table.

I can’t confirm that this created the issue, but after I did this I started getting the following error when running the criteria query:

Object with id: ‘blahblahblah’ was not of the specified subclass: Person (loaded object was of wrong class class coldfusion.orm.PersistentTemplateProxy)

I can’t replicate this in my dev environment, so I can’t confirm that the two are precisely related. However, I had never seen this error until I made that data update.

I can seem to fix it for a while with an ORMReload(). However, after a while it seems to come back again (presumably because I updated records that aren’t interacted with until a future time?).

If this sounds confusing, most of it is probably because I’m horribly confused about what’s going on, what I should do to fix it, if it can be fixed, etc.

Does anyone have any thoughts on this issue?

NOTE: I have seen this rather lengthy thread: https://groups.google.com/forum/?fromgroups#!topic/cf-orm-dev/f3Dj-2kFoIk

While it describes the error I’m getting, there doesn’t seem to be the exact same conditions, AND (worst of all) there are no real conclusions that I can see.

I appreciate any help anyone can give.


I’ve seen this error, too. A reinit resolves it.

Yes, it does, but not permanently. Every time I reload the app (via applicationstop() or full CF restart), it comes back and I have to reinit again :frowning:

This error only appears (and not every time) when the application inits for the first time. And doesnt happen to the first entity to be used.

For me, it happens every time when the application inits for the first time, and always happens on the first entity related to this query.

I would remove CB’s classes and use pure CF ORM to see if the issue persists.

I would also cross-post to https://groups.google.com/forum/?fromgroups=#!forum/cf-orm-dev

RE: pure ORM, I did. Same result :slight_smile: