# EntityLoadByPK

Load an array of entities by the primary key.

`var myAuto = entityLoadByPK( "Automobile", "1HGCM82633A123456" );`

In Lucee, by default, an array of entities is returned and you must pass a third \`unique=true\` argument to return only a single entity. In BoxLang, only a single entity is returned - matching the Adobe ColdFusion behavior - and no \`unique\` attribute is supported. To return an array of entities, use the \`entityLoad\` BIF.

Composite keys are also supported:

```
 entityLoadByPK( "VehicleType", { make : "Ford", model: "Fusion" } );
 
```

## Method Signature

```
EntityLoadByPK(entity=[String], id=[String], unique=[String])
```

### Arguments

| Argument | Type     | Required | Description                                                               | Default |
| -------- | -------- | -------- | ------------------------------------------------------------------------- | ------- |
| `entity` | `String` | `true`   | The name of the entity to load.                                           |         |
| `id`     | `String` | `true`   | The primary key value, or a struct of key/value pairs for composite keys. |         |
| `unique` | `String` | `false`  | Not implemented. In BoxLang, a single entity is always returned.          |         |

## Examples

## Related

* [EntityDelete](/reference/built-in-functions/entitydelete.md)
* [EntityLoad](/reference/built-in-functions/entityload.md)
* [EntityLoadByExample](/reference/built-in-functions/entityloadbyexample.md)
* [EntityMerge](/reference/built-in-functions/entitymerge.md)
* [EntityNameArray](/reference/built-in-functions/entitynamearray.md)
* [EntityNameList](/reference/built-in-functions/entitynamelist.md)
* [EntityNew](/reference/built-in-functions/entitynew.md)
* [EntityReload](/reference/built-in-functions/entityreload.md)
* [EntitySave](/reference/built-in-functions/entitysave.md)
* [EntityToQuery](/reference/built-in-functions/entitytoquery.md)
* [ORMClearSession](/reference/built-in-functions/ormclearsession.md)
* [ORMCloseAllSessions](/reference/built-in-functions/ormcloseallsessions.md)
* [ORMCloseSession](/reference/built-in-functions/ormclosesession.md)
* [ORMEvictCollection](/reference/built-in-functions/ormevictcollection.md)
* [ORMEvictEntity](/reference/built-in-functions/ormevictentity.md)
* [ORMEvictQueries](/reference/built-in-functions/ormevictqueries.md)
* [ORMExecuteQuery](/reference/built-in-functions/ormexecutequery.md)
* [ORMFlush](/reference/built-in-functions/ormflush.md)
* [ORMFlushAll](/reference/built-in-functions/ormflushall.md)
* [ORMGetHibernateVersion](/reference/built-in-functions/ormgethibernateversion.md)
* [ORMGetSession](/reference/built-in-functions/ormgetsession.md)
* [ORMGetSessionFactory](/reference/built-in-functions/ormgetsessionfactory.md)
* [ORMReload](/reference/built-in-functions/ormreload.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bxorm.ortusbooks.com/reference/built-in-functions/entityloadbypk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
