entitySave weirdness, possible bug?

Hi there,
I have an issue with entitySave().
in that the following code does NOT persist the updated value to the database.

arguments.customer.setlastInvoiceDateUTC(arguments.billingStruct.utcDay);
entitySave(arguments.customer);

however object.save() does;

arguments.customer.setlastInvoiceDateUTC(arguments.billingStruct.utcDay);
arguments.customer.save();

Is there something I should be doing in code or checking in ORM config options? - that would explain the difference?

Thanks!

Don’t forget to tell us about your stack!

OS: Ubuntu (5.10.102.1-microsoft-standard-WSL2) / Docker
Java Version: openjdk 11.0.15 2022-04-19
Tomcat Version: Dunno - sorry!
Lucee Version: 5.3.9.141-RC

dunno I don’t use the orm stuff that much at all

I always go and look at the test cases, see link at the bottom of the above link

maybe an ormFlush will help?

Hi Everyone,
I have worked it out.

The problem was of my own creation.
Indeeed @Zackster, I needed to add an ormFlush().
Because although in Lucee/Admin Flush at request end is TRUE, in Application.cfc it is set to false.
So the fact that it didn’t save, is the expected behaviour with my code.

But then I was wondering, why is it that object.save() worked without the ormFlush()?

So I looked into the code, and found that we have defined a superclass that all ORM classes inherit from - and in that class is a save() method - where the entitySave() is wrapped in a transaction / try and transactionCommit(), ensures the data saved to the DB.

Whoever thought that reading your own code, could be so insightful?
Gavin.