Skip to main content
Participating Frequently
August 9, 2018
Question

CF2018 / Hibernate / Sequences not being utilized & mappings not being saved

  • August 9, 2018
  • 1 reply
  • 990 views

Hoping someone can help with this issue! I've set up ORM settings as below and my model is set up as listed. However, when utilizing, I keep getting an error that ID already exists and it appears CF is using hibernate_sequence instead of the sequence I'm specifying.  Furthermore, even with savemapping=true, it is not creating any hibernate xml files (supposed to be in same directory as models).

I'm using Postgresql as the DB. I've tried restarting / different settings (even different JDBC drivers), etc without success. 

This code was working fine with CF10 and trying to upgrade (unsuccessfully) to CF2018.

 

this["ormsettings"] = {

      datasource = "db_icp",

      eventHandling = false,

      logsql=false,

      savemapping=true,

      cfclocation = application.mappings["models"]

};

 

component name="logins" entityName="logins" persistent="true" table="logins"

{

        property name="id" column="id" fieldtype="id"

                generator="sequence" params="{sequence='seq_logins_id'}";

 

        property name="userName" type="string" hint="user who attempted login";

        property name="dateInserted" ormtype="timestamp" hint="datetime of the login attempt";

 

        property name="ipAddress" type="string" hint="IP address logged in from";

 

}

This topic has been closed for replies.

1 reply

rahul_u
Community Manager
Community Manager
August 9, 2018

Can you please share the exact error message with screenshot?

WarpuserAuthor
Participating Frequently
August 9, 2018

Unfortunately, after spending about 10 hours on it, I gave up and installed Lucee instead, where it's working. As a side note, it was impossible to download installers for anything earlier than CF 2018 to test where the change between CF10 & CF 2018 occurred.

The error message indicated the id already existed in the table ("id = 563 already exists , violates primary key constraint"), which makes sense because it was using "hibernate_sequence" instead of the sequence I specified in ORM.  I even tried it with a brand new app with one model and an index.cfm file with exact same results.

rahul_u
Community Manager
Community Manager
August 9, 2018

If you need installers for CF11 or CF2016 for testing, please let me know.