# ORM

Ortus have forked the original Lucee ORM extension and are actively maintaining it.

[Ortus Lucee ORM Extension](https://www.ortussolutions.com/products/orm-extension)

[Ortus ORM Extension on Forgebox](https://www.forgebox.io/view/D062D72F-F8A2-46F0-8CBC91325B2F067B)

The Lucee ORM extension is no longer maintained, anyone still using the Lucee version is advised to migrate.

# Functions

- **function-entitydelete** - Deletes the record from the database for the specified entity. EntityDelete(entity)
- **function-entityload** - Loads and returns an array of entities of the specified entityname.
- **function-entityloadbyexample** - Loads and returns an array of objects that match the sample entity.
- **function-entityloadbypk** - Loads and returns an array of objects for given primary key.
- **function-entitymerge** - Attaches given entity to current ORM session
- **function-entitynamearray** - return all loaded entities as array
- **function-entitynamelist** - return all loaded entities as string list
- **function-entitynew** - Creates a new instance of the persistent CFC with the entity name that you provide.
- **function-entityreload** - Reloads data for an entity that is already loaded.
- **function-entitysave** - Saves or updates data of the entity and all related entities to the database.
- **function-entitytoquery** - Converts the input entity object or the input array of entity objects to a query object.
- **function-ormclearsession** - Removes all the entities that are loaded or created in the session.
- **function-ormcloseallsessions** - Closes all ORM session.
- **function-ormevictcollection** - This will remove all the entries with the specified relation/collection name in the specified component.
- **function-ormevictentity** - This will remove all the entries for the specified component name from the entity cache.
- **function-ormevictqueries** - This will remove all the queries from the named query cache.
- **function-ormexecutequery** - Runs the HQL on the default data source specified for the application.
- **function-ormflush** - Flushes the current ORM session.
- **function-ormgetsession** - Returns the current ORM session
- **function-ormgetsessionfactory** - Returns ORM session factory instance
- **function-ormreload** - Returns ORM session factory instance
- **function-transactioncommit** - commits a pending transaction
- **function-transactionrollback** - rolls back a pending transaction
- **function-transactionsetsavepoint** - Saves a specific state within a transaction

# Tags

- **tag-transaction** - Groups multiple queries into a single unit. The cftransaction tag provides commit and rollback processing.

# Categories

- **category-query** - 

# Guides

- **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-intro** -  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


# Categories

[Queries](query.md)