Skip to main content
Inspiring
May 19, 2021
Answered

ColdFusion 2021 Errors

  • May 19, 2021
  • 1 reply
  • 1765 views

Recently we started upgrading ColdFusion from 2016 to 2021.

So tried to install ColdFusion 2021 and using 30 days free trial for testing purpose

Application can’t make Database Calls so can’t able to login into application and can’t perform CURD operations.

Below are orm settings in application.

ormenabled = true;

ormsettings = {};

ormsettings.cfclocation = [… ];

ormSettings.dbcreate = "update";

ormSettings.flushAtRequestEnd = false;

ormsettings.eventhandling = true;

ormSettings.automanageSession = false;

ormSettings.savemapping = false;

ormSettings.skipCFCwitherror = false;

ormSettings.useDBforMapping = true;

ormSettings.autogenmap = true;

ormSettings.logsql = true;

 

And below are some errors on Hibernate level.

  1. Error executing DDL via JDBC Statement

Getting this error when adding new properties on entities like case, group. Because those are reserved words in database

 

Tried below options to resolve this issue but none helpful.

Adding hibernate properites as  jvm arguments, orm properties, and created hibernate.cfg.xml file

hibernate.globally_quoted_identifiers

hibernate.auto_quote_keyword

hibernate.globally_quoted_identifiers_skip_column_definitions

 

[Found]

https://hibernate.atlassian.net/browse/HHH-12192

Suggesting to upgrade hibernate-core version 5.2.13

 

  1. org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1

Getting this error on calling ormFlush();

[Found]
https://hibernate.atlassian.net/browse/HHH-12878

Suggesting to upgrade hibernate-core version 5.4.1

 

so is there any possibility for updating hibernate jars in ColdFusion 2021?

Or other possibilities to fix all those issues?

 

  

    This topic has been closed for replies.
    Correct answer SKKB

    @BKBK i am back

    what i found is,

    i can update existing db record with or without transaction , but can't save new records.

    On saving new records i am getting this error.

    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

    Ex:1

    <cfset account1 = entityLoad("Account", "123")> 
    <cfset account2 = entityLoad("Account", "789")> 
    <cfset account1.debit(1000)> 
    <cfset account2.credit(1000)> 
    <cfset entitySave(account1)> 
    <cfset entitySave(account2)> 

    It works without mentioning transaction explicitly.

    Ex: 2

    <cfset accountObj = entityNew("Account")> 
    <cfset entitySave(accountObj)>  

    the above code throws below error and not working with/without Transaction.

    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

    i got struk here again. 

    Note: i am using UUID auto generator for ID's

     


    just found that i am always getting update logs

    entitySave(Obj,true) is need for me to call explicitly to called

    entitySave(obj) always updates me.

    this is the fix for my application.

     

    Many Thanks for all who tried to reach me out.

    1 reply

    BKBK
    Community Expert
    Community Expert
    May 20, 2021

    @SKKB : ... so is there any possibility for updating hibernate jars in ColdFusion 2021?

     

    Don't!

    Use the Hibernate that ships with ColdFusion (v5.2). It has been extensively tested and optimized for use in ColdFusion. 

     

    > ... Application can’t make Database Calls so can’t able to login into application and

    > can’t perform CURD operations.

     

    That is probably because you have not yet created a datasource for Hibernate to use.

    Go to the datasource page in the ColdFusion Administrator. If you haven't done so yet, create a datasource which Hibernate will use.

     

    For example, my datasource is called cfTest_db. The relevant settings in my Application.cfc file are:

     

    this.datasource="cfTest_db";
    this.ormSettings.dialect = "MySQL";

    SKKBAuthor
    Inspiring
    May 20, 2021

    @BKBK  Thanks

    I have datasource configured.
    for testing purpose we have careated new DB, there hibernate creates all entities > Tables created on first invoke. Then it started throwing error on calling ormFlush();

    then i updated ormFlush() to ormFlush(ORMGetSession());

    then i can able to passon to login screen without errors.

    but application can't able to login.

    and i didn't see any error log, when i check log files.

    that was the blocker for my setup process in CF2021.

     

    BKBK
    Community Expert
    Community Expert
    May 22, 2021
    quote

    Then it started throwing error on calling ormFlush();

    then i updated ormFlush() to ormFlush(ORMGetSession());

     

    By @SKKB

     

    Do you have similar settings to the ones I suggested in my last post? That is:

        this.datasource="cfTest_db";
        this.ormSettings.dialect = "MySQL";

    If so, then it will be sufficient to use:  ormFlush();

    Alternatively, you could use: ormFlush(your_datasource_name);

    But, as far as I know, the following is wrong: ormFlush(ORMGetSession());

     

    The log file to pay attention to is: hibernatesql.log