Lucee 6 upgrade issue - ORM cannot cast

We are working on upgrading to Lucee 6 (6.0.3.1) and have come across a few compatibility issues. Please let me know if it would be useful to create a JIRA ticket for these issues. We have not found a workaround for this problem.

The test case below demonstrates one of the class cast problems we’ve seen using the ORM capabilities of Lucee. Additionally, we’ve seen similar class casting problems when hibernate attempts to flush the session at the end of the request. This example works with Lucee 5 but fails on version 6.

I’ve tried the lucee hibernate extension and the latest version of the Ortus ORM extension with multiple versions of Lucee 6. The latest tests have been with:

Lucee 6.2.0.1-SNAPSHOT
Ortus ORM Extension 7.0.0.68-snapshot

Error:

Message class java.lang.String cannot be cast to class java.math.BigDecimal (java.lang.String and java.math.BigDecimal are in module java.base of loader ‘bootstrap’)

Stacktrace
The Error Occurred in C:\work\webroot\lucee6\orm\ormtest2.cfm: line 12
10: minBalance = 10000.023423430;
11: queryStr = “FROM Person WHERE balance > :minBalance”;
12: results = ORMExecuteQuery(queryStr, {minBalance: minBalance});
13:
14: for (person in results) {

Example code:

Application.cfc

component {
    this.name = "LuceeORMExample";

    this.ormEnabled = true;
    this.ormSettings = {
        dbCreate = "update",
        dialect = "org.hibernate.dialect.H2Dialect",
        logSQL = true
    };
    
    this.datasources["h2datasource"] = {
        class: "org.h2.Driver", 
        bundleName: "org.lucee.h2", 
        bundleVersion: "2.1.214.0001L",
        connectionString: "jdbc:h2:\temp\h2OrmTest",
        username: "sa",
        password: ""
    };

    this.datasource = "h2datasource";

}

Person.cfc

component persistent="true" table="person" {
    property name="id" fieldtype="id" generator="native";
    property name="firstName" ormtype="string";
    property name="lastName" ormtype="string";
    property name="balance" ormtype="big_decimal";
}

test.cfm

<cfscript>
    // Create a new person
    person = new Person();
    person.setFirstName("John");
    person.setLastName("Doe");
    person.setBalance(12345.123456);
    entitySave(person);
    
    // Query
    minBalance = 10000.023423430;
    queryStr = "FROM Person WHERE balance > :minBalance";
    results = ORMExecuteQuery(queryStr, {minBalance: minBalance});
   
    for (person in results) {
        writeDump(person);
    }
</cfscript>