Object-relational mapping



  • EntityDelete Deletes the record from the database for the specified entity. EntityDelete(entity)
  • EntityLoad Loads and returns an array of entities of the specified entityname. EntityLoad (entityname, filtercriteria [,unique] EntityLoad(entityname, filtercriteria, sortorder [, options])
  • EntityLoadByExample Loads and returns an array of objects that match the sample entity. entityLoadByExample(sampleEntity,[unique])
  • EntityLoadByPK Loads and returns an array of objects for given primary key.
  • EntityMerge Attaches given enity to current ORM session
  • EntityNameArray return all loaded entities as array
  • EntityNameList return all loaded entities as string list
  • EntityNew Creates a new instance of the persistent CFC with the entity name that you provide.
  • EntityReload Reloads data for an entity that is already loaded.
  • EntitySave Saves or updates data of the entity and all related entities to the database. EntitySave(entity, [forceinsert])
  • EntityToQuery Converts the input entity object or the input array of entity objects to a query object.
  • ORMClearSession Removes all the entities that are loaded or created in the session. This clears the first level cache and removes the objects that are not yet saved to the database.
  • ORMCloseAllSessions Closes all ORM session.
  • ORMEvictCollection This will remove all the entries with the specified relation/collection name in the specified component. ormEvictCollection(componentName,relationName,[id])
  • ORMEvictEntity This will remove all the entries for the specified component name from the entity cache. ormEvictEntity(componentName,[id])
  • ORMEvictQueries This will remove all the queries from the named query cache. If name is not specified, all quiries from default cache will be removed. ormEvictQueries([cacheName])
  • ORMExecuteQuery Runs the HQL on the default data source specified for the application.
  • ORMFlush Flushes the current ORM session. ORMFlush flushes all the pending CRUD operations in that request. Any changes made in the objects, in the current ORM session, are saved to the database.
  • ORMGetSession Returns the current ORM session
  • ORMGetSessionFactory Returns ORM session factory instance
  • ORMReload Returns ORM session factory instance
  • TransactionCommit commits a pending transaction
  • TransactionRollback rolls back a pending transaction
  • TransactionSetSavePoint Saves a specific state within a transaction


  • ORM:first_example ## First example ## Let's have a look at a simple example where we want to persist a certain CFC to a MySQL database. Further below all necessary steps in order to get ORM to work with Lucee are described. We will assume the following scenario: We have an easy blog where an author can submit his blog post containing the following properties for an entry: * author * publish date * title * teaser * text * tags Nothing more for the moment
  • ORM:introduction ### ORM with Lucee ### This section is going to describe how ORM (object relational mapping) is handled by Lucee 3.2 Server. Lucee Server uses Hibernate in the background for implementing ORM. If you want to learn more about Hibernate, just check the corresponding [documentation](http://www.hibernate.org/). ### What is ORM ? ### According to Wikipedia ORM is: Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages


  • <cftransaction> Groups multiple queries into a single unit. The cftransaction tag provides commit and rollback processing.

See also