cborm
v4.x
Search
K
Links

Installation

Quickly install cborm
Leverage CommandBox to install into your ColdBox app:
# Latest version
install cborm
# Bleeding Edge
install cborm@be

System Requirements

  • Lucee 5.x+
  • ColdFusion 2018+

Application.cfc Setup

Unfortunately, due to the way that ORM is loaded by ColdFusion, if you are using the ORM EventHandler or ActiveEntity or any ColdBox Proxies that require ORM, you must create an Application Mapping to the module in the Application.cfc like this:
Application.cfc
# In the pseudo constructor
this.mappings[ "/cborm" ] = COLDBOX_APP_ROOT_PATH & "modules/cborm";

WireBox DSL

The module registers a new WireBox DSL called entityservice which can produce virtual or base ORM entity services. Below are the injections you can use:
  • entityservice - Inject a global ORM service
  • entityservice:{entityName} - Inject a Virtual entity service according to entityName

Module Settings

Here are the module settings you can place in your ColdBox.cfc under moduleSettings -> cborm structure or by creating a cborm.cfc in the config/modules directory if you are in ColdBox 7.
config/ColdBox.cfc
moduleSettings = {
cborm = {
// Resource Settings
resources : {
// Enable the ORM Resource Event Loader
eventLoader : false,
// Pagination max rows
maxRows : 25,
// Pagination max row limit: 0 = no limit
maxRowsLimit : 500
},
// WireBox Injection bridge
injection = {
// enable entity injection via WireBox
enabled = true,
// Which entities to include in DI ONLY, if empty include all entities
include = "",
// Which entities to exclude from DI, if empty, none are excluded
exclude = ""
}
}
}
ColdBox 7 Config:
config/modules/cborm.cfc
1
component{
2
3
function configure(){
4
return {
5
// Resource Settings
6
resources : {
7
// Enable the ORM Resource Event Loader
8
eventLoader : false,
9
// Pagination max rows
10
maxRows : 25,
11
// Pagination max row limit: 0 = no limit
12
maxRowsLimit : 500
13
},
14
// WireBox Injection bridge
15
injection = {
16
// enable entity injection via WireBox
17
enabled = true,
18
// Which entities to include in DI ONLY, if empty include all entities
19
include = "",
20
// Which entities to exclude from DI, if empty, none are excluded
21
exclude = ""
22
}
23
};
24
}
25
}

Validation

We have also integrated a UniqueValidator from the validation module into our ORM module. It is mapped into WireBox as UniqueValidator@cborm so you can use it in your model constraints like so:
{ fieldName : { validator: "UniqueValidator@cborm" } }

Supported Hibernate Versions

Lucee 5

Adobe 2018, Adobe 2021