CF Snippets

Enable and configure Hibernate ORM

This basic ORM configuration should quickly get you going with ColdFusion's built-in Hibernate ORM.

// Application.cfc
component {
  this.ormEnabled = true;
  this.ormSettings = {
    // the datasource Hibernate will use to connect to the database.
    datasource = "mainDB",
    // helpful for development but NOT recommended for production!
    logSQL = "true",
    // make table updates on detecting changes to the ORM models.
    // probably best to turn this off in prod and use cfmigrations or similar
    // to manually handle the database updates.
    dbcreate = "update",
    // where to look for persistent models (aka ORM entities defined via CFML components)
    cfclocation = [ "models/orm/", "modules_app/admin/orm/" ],
    // what sort of database are you using?
    dialect = "MicrosoftSQLServer"
  };
}