BxORM is a whole framework on top of Hibernate, built for a dynamic language. Write a class, get a table. Then save, load and query rows as objects with static helpers, fluent criteria, automatic type conversion and errors written for humans. No XML, no Java classes, no casting.
bx-module install bx-orm// models/User.bx: one class, one table. That's the mapping. @persistent @table( "users" ) @softDelete class { @fieldtype( "id" ) @generator( "native" ) property id; @ormtype( "string" ) @unique property email; @ormtype( "timestamp" ) @autoTimestamp( "create" ) property createdDate; @fieldtype( "one-to-many" ) @cfc( "Order" ) @fkcolumn( "userID" ) property orders; function postCommit( entity, action ){ // only after a real commit: send the welcome email } }
// No service layer, no base class: the entity is the API user = User::getOrFail( rc.id ); // "42" from the URL? fine admin = User::findWhere( { email : "admin@example.com" } ); total = User::count( { active : true } ); page = User::list( { max : 25, offset : 50, sort : "email" } ); tag = Tag::firstOrCreate( { name : rc.tag } ); transaction { entitySave( User::new( { email : "ann@example.com", active : true } ) ); } // one UPDATE, no entities loaded User::updateWhere( { active : false }, { role : "guest" } );
// Fluent, checked, always parameterized fords = Vehicle::criteria() .isEq( "manufacturer.name", "Ford Motor Company" ) // joined for you .anyOf( ( c ) => c.isGt( "year", 2020 ).isLt( "price", 20000 ) ) .order( "price" ) .asStruct( "id,model,price,manufacturer.name" ) .paginate( page = 1, maxRows = 25 ); // Or HQL. Names are case-insensitive, like BoxLang. users = ormExecuteQuery( "from user where firstname = ?", [ "Luis" ] );
[firstName]?Hibernate was built for static Java classes, XML mappings and typed parameters. BxORM does all the translation, so a dynamic language gets the whole engine and none of the ceremony.
BxORM doesfirstname finds firstNameUser::get() on every entitypreInsert, postCommit, vetoorm.* types with the fixtransaction{}onORMQuery, onORMFlush events"42", dates and booleans converted for youorm.* errors with your names and the fixtransaction{} and BoxCacheNo service objects, no base class, no injection. At startup every entity class gets static methods, and each one is the BIF you already know with the entity name filled in: same session, same events, same errors.
get()getOrFail()getAll()read()getReference()findWhere()findAllWhere()first()exists()count()list()new()firstOrNew()firstOrCreate()updateWhere()deleteWhere()criteria().deleteAll()entityDelete( entity )deleteWhere() runs one DELETE and refuses an empty filter. entityDelete() fires events and honors soft delete.criteria()executeQuery()function show( event, rc, prc ){ // orm.notFound with a clear message if it's not there prc.order = Order::getOrFail( rc.id ); } function index( event, rc, prc ){ prc.orders = Order::list( { max : 25, offset : ( rc.page - 1 ) * 25, sort : "createdDate desc" } ); prc.total = Order::count( { status : "open" } ); } function tag( event, rc, prc ){ // find it, or create it on first use return Tag::firstOrCreate( { name : rc.tag } ); }
entityCriteria() builds a query one method at a time. Property names are checked as you go, values are always bound as parameters, and a dotted path joins its associations for you.
manufacturer.nameanyOf(), allOf(), subqueries, projections and groupingpaginate(), streaming, and bulk updateAll() / deleteAll()asStruct() builds JSON-ready structs without loading entitiescars = entityCriteria( "Vehicle" ) .isEq( "manufacturer.name", "Ford Motor Company" ) .isGt( "year", 2020 ) .order( "price" ) .list();
anyOf() and for orderingBoxLang is dynamic; JDBC is not. BxORM puts a converter on every property, chosen from its ormtype, and uses BoxLang's own casters both ways. The string from your form is stored as an integer, and a date comes back as a BoxLang date.
isEq( "id", "42" ) works for a numeric idorm.property.type error, not a database surpriserc.id = "42"→IntegerConverter→INTEGER→42price = "19.99"→BigDecimalConverter→DECIMAL→19.99created = now()→DateTimeConverter→TIMESTAMP→DateTimeactive = true→BooleanConverter→BOOLEAN→trueEvery error BxORM raises is written for BoxLang developers: the message uses your entity and property names, the detail says how to fix it, and misspelled names get a suggestion. All the context is in extendedInfo.
orm.* errors: catch one, a family, or all of themormDiagnostics() never throws and shows the ORM's stateBxORM announces each SQL statement, flush and failure as an event. Install BxLens and turn on its ORM integration: your ORM SQL shows up next to your other queries, with the time, the rows and the BoxLang line that ran it.
$ bx-module install bx-lens
"collectors" : { "orm" : { "enabled" : true } }
Then open the bar on any page, or the console at /~bxlens/index.bxm. ORM in BxLens →


BxORM saves everything it works out at startup in a .bxorm/ folder: entity metadata, Hibernate mappings and the generated entity classes. Build it in CI, trust it in production. One setting: ormManifest.
"off" every boot
"auto" development
"trust" production
boxlang module:orm generate→
.bxorm/→
Docker image→
"trust"
The CLI builds the cache with no server, database or application start. A trust boot refuses to start on a stale cache and names what changed.
Synthetic models with associations, local MariaDB. From the Performance docs. On a cold class cache a trust boot adds about 2 ms per entity.
Seven agent skills teach Claude Code, Copilot, Cursor, Codex and friends how BxORM 2 really works: annotations, relationships, criteria, transactions, the boot cache and observability. Install them once and ask in plain words.
bx-orm-entitiesAnnotations, tables, soft delete, ids and generators, inheritance and static entity methods.
bx-orm-relationshipsOne-to-one to many-to-many, inverse, lazy loading, cascades and the generated add/has/remove methods.
bx-orm-queryingThe entityLoad family, HQL with ormExecuteQuery(), paging, streaming and the query cache.
bx-orm-criteriaentityCriteria(): conditions, joins, subqueries, projections, asStruct() and bulk updates.
bx-orm-transactionstransaction{}, mixing ORM and queryExecute(), savepoints, flushing and the session.
bx-orm-configurationormSettings, dialects, naming strategies, caching, the boot cache and the module:orm CLI.
bx-orm-observabilityonORMQuery and friends, slow SQL, statistics and ormDiagnostics().
+ every BoxLang skillLanguage, modules and frameworks, in one plugin.
# all seven BxORM skills npx skills add ortus-boxlang/skills/boxlang-modules/bx-orm # or just one npx skills add ortus-boxlang/skills/boxlang-modules/bx-orm/bx-orm-criteria
# every BoxLang skill, plus the BxORM docs MCP server
claude plugin marketplace add ortus-boxlang/skills
claude plugin install boxlang-agent-skills@boxlang-agent-skills
codex plugin marketplace add ortus-boxlang/skills codex plugin add boxlang-agent-skills@boxlang-agent-skills
# ColdBox app: guidelines, agent files and docs MCP servers coldbox ai install agent=claude,copilot # pick the bx-orm-* skills from the registry coldbox ai skills install --list # or one by path coldbox ai skills install ortus-boxlang/skills/boxlang-modules/bx-orm/bx-orm-criteria # cborm skill (automatic when cborm is in box.json) coldbox ai skills install coldbox/skills/modules/cborm # BxORM docs MCP server coldbox ai mcp add name=bxorm url=https://bxorm.ortusbooks.com/~gitbook/mcp
Browse them all at skills.boxlang.io · source in ortus-boxlang/skills
The Quick Start, in four steps.
# CommandBox box install bx-orm bx-mysql # or the BoxLang module installer bx-module install bx-orm bx-mysql
class { this.name = "quickstart"; this.datasource = "appDB"; this.ormEnabled = true; this.ormSettings = { entityPaths : [ "models" ], dbcreate : "update", // development only eventHandling : true, ormManifest : getSystemSetting( "ORM_MANIFEST", "auto" ) }; }
@persistent @table( "users" ) @defaultSort( "lastName" ) class { @fieldtype( "id" ) @generator( "native" ) @ormtype( "integer" ) property id; @ormtype( "string" ) property firstName; @ormtype( "string" ) property lastName; function getFullName(){ return getFirstName() & " " & getLastName(); } }
transaction { entitySave( entityNew( "User", { firstName : "Ann", lastName : "Lee" } ) ); } lees = User::findAllWhere( { lastName : "Lee" } ); ann = User::findWhere( { firstName : "Ann" } ); json = entityToStruct( ann ); transaction { entityDelete( ann ); }
Seventeen short lessons: twelve from your first entity to a production boot, then five to go further with inheritance, testing, cborm, AI and moving from CFML. Every lesson ends with code you can run, and your progress is saved in your browser.
@softDelete: deletes mark the row, and every load skips it.
@autoTimestamp( "create" ) and "update", set for you.
entityToStruct() for JSON APIs, mementifier compatible. entityToQuery() for reports.
Return false from preInsert to cancel. postCommit only fires for real commits.
The second-level cache runs on BoxLang caches, distributed ones included.
onORMQuery, onORMFlush and onORMException, free when nobody listens.
Pessimistic locks, optimistic versions and read-only loads.
Composite keys, single-table and joined inheritance, value collections.
Install the module, point it at a datasource and save your first row as an object.
bx-module install bx-orm