Cannot load an entity

I am not sure what the cause is - but I have worked how to fix it…
Nonetheless - I am asking if this symptom is a bug or not?

For a new developer, never installed anything Lucee or our code-base.
We use CommandBox. (latest)
We’re using the Lucee 3.5.5.latest Hibernate extension.
When going to the “home page” - I get the login page (as expected)

So it seems that everything is working correctly.

But upon form submission - I get the following error for Lucee 5.3.x.x and 5.4.x.x.
lucee cannot load an entity customer:1

Restarting the Lucee Server does not fix the issue.
Performing an application restart via applicationStop() - does not fix the issue.

After a couple of hours - I thought to perform an ormReload() - and the application has worked flawlessly, since.

My question is - why is it so?

I am expecting that upon application initialisation / start - that if you have ORM enabled, that it would do everything that is needed for my application to run correctly.

Whatever it is that ormReload() is doing when run manually - should happen automatically, right?

I am currently getting around it by adding ormReload() to my onApplicationStart() - but I really feel this shouldn’t be necessary.

OS: Windows
Java Version:
Tomcat Version: Undertow ???
Lucee Version: 5.4.3.2 / 5.4.3.4-SNAPSHOT / 5.3.10.97

You’re right. Normally, ormReload() shouldn’t be necessary.

The way in which you got the application to work suggests:

  • one or more of the following ORM variables is not (well) defined in Application.cfc:
    this.datasource
    this.ormEnabled
    this.ormSettings

  • the current ORM session is flushed or cleared somewhere, by means of code such as:
    ormClearSession()
    ormCloseAllSessions()
    ormFlush()

Hi,

I didn’t think of any of those - so thanks.
However in this instance - all those items are appropriately / uniformly set.
(We have multiple Application.cfc’s) and where duplicated are the same.

And we don’t manually use ormClearSession/Flush/etc - either.

I’m certainly not saying that our code is not at fault…
But anecdotedly - we started having ORM issues when the Lucee JAR started getting “thinned-out”.

And I would love to use the Ortus ORM extension, too - but it means a jump to v5 from v3 of Hibernate - which requires code changes that we don’t have time for - right now.