Ship it

Production settings, the boot cache and the bxorm CLI for fast starts, and the second-level cache for fast reads.

On this page

The blog works. Before it goes live, three things change: the schema stops changing itself, the ORM boots from a cache, and hot data gets cached between requests.

Production settings

dbcreate : "update" is great while you learn, but in production your schema should only change through migrations you control. Turn it off, and stop printing SQL:

this.ormSettings = {
    entityPaths   : [ "/blog/models" ],
    dbcreate      : "none",
    eventHandling : true,
    logSQL        : false,
    // "auto" on your machine and in CI, "trust" in production
    ormManifest   : getSystemSetting( "ORM_MANIFEST", "auto" )
};

The boot cache

At startup, BxORM discovers your entities, reads their annotations and generates the Hibernate mappings and entity classes. The boot cache saves all of that in a .bxorm/ folder, so later boots can skip it. The ormManifest setting picks the mode:

ModeAt startupUse it for
offDiscover, parse and map every entity (the default)Anything
autoBoot normally, then write the cache. Reload on editsDevelopment
trustBoot straight from the cacheProduction

The gain grows with your model: on large models, trust cuts boot time by about a third to a half.

A trust boot fails closed. If an entity, a key setting or the bx-orm version changed since the cache was written, it refuses to start and says what changed:

ORM manifest mode is [trust] but the manifest at [.bxorm/manifest-blog.json] is stale:
entity [Tag] source changed: /blog/models/Tag.bx. Regenerate it with `boxlang module:orm generate`

The bxorm CLI

You don't need to boot the app to build the cache. From the app folder:

boxlang module:orm generate
Wrote the ORM boot cache for [blog]: 3 entities in 450ms
   blog/.bxorm/manifest-blog.json
   blog/.bxorm/facades-blog.jar

It reads your Application.bx settings without starting the app or opening a database, so it runs in a Docker build or a CI step. Other verbs:

VerbWhat it does
infoThe cache header: versions, entity count, integrity
validateChecks each manifest. Exits with 1 on a problem
entitiesThe entities in the cache
entity <name>One entity, with its mapping XML
clearDeletes the cache files

validate fits a CI step that guards your deploys:

boxlang module:orm generate
boxlang module:orm validate

If your server defines mappings or datasources in boxlang.json instead of Application.bx, pass the same file: boxlang --bx-config runtime/boxlang.json module:orm generate. Deploy the .bxorm/ folder with the app and set ORM_MANIFEST=trust.

The second-level cache

The session caches entities only until it ends. The second-level cache keeps them across requests, in BoxLang's own BoxCache. Tags rarely change, so they are a good fit:

this.ormSettings = {
    // ...
    secondaryCacheEnabled : true
};
@persistent
@table( "tags" )
@cacheuse( "read-write" )
@cachename( "tags" )
class {
    // ...
}

Now entityLoadByPK( "Tag", 1 ) reads from the tags cache after the first load, in any request. Criteria queries can cache their results too, with .cache().

Try it

  • Run boxlang module:orm generate, then info and validate.
  • Switch to ormManifest : "trust", edit an entity and start the app. Read the error, then regenerate.
  • Cache Tag and load the same tag in two requests. With logSQL on, how many selects run?

Learn more

Edit this page Download Markdown Last updated Nov 23, 2026, 5:56:16 PM Report an issue
Lesson 12 of 17 - Learn BxORM