Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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=[Any], unique=[String])

Arguments

Argument
Type
Required
Description
Default

entity

String

true

The name of the entity to load.

id

Any

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

Load by Primary Key

Load entity by primary key:

Load by Composite Key

Pass a struct when the entity key is composite.

Last updated

Was this helpful?