All pages
Powered by GitBook
1 of 3

Loading...

Loading...

Loading...

getRestrictions

Get our hibernate org.hibernate.criterion.Restrictions proxy object that will help you produce criterias.

Returns

  • This function returns an instance of cborm.models.criterion.Restrictions

Examples

Adobe ColdFusion will throw an "Invalid CFML construct" for certain CBORM methods that match , such as .and(), .or(), and .eq(). To avoid these errors and build cross-engine compatible code, use .$and(), .$or(), and .isEq().

// Get an instance of the restrictions
var restrictions = ormService.getRestrictions();

// Restrictions used with criteria queries
var r = ormService.getRestrictions();
var users = ormService.newCriteria("User")
    .or( r.eq("lastName","majano"), r.gt("createDate", now()) )
    .list();
reserved operator names

newCriteria

Get a brand new criteria builder object to do criteria queries with (See ORM:CriteriaBuilder)

Returns

  • This function returns coldbox.system.orm.hibernate.CriteriaBuilder

Arguments

Examples

queryCacheRegion

string

false

criterias.{entityName}

The queryCacheRegion name property for all queries in this criteria object

datasource

string

false

The datasource to use or default it to the application or entity in use

Key

Type

Required

Default

Description

entityName

string

true

---

The entity name to bind the criteria query to

useQueryCaching

boolean

false

false

Do automatic query caching for queries

var users = ORMService.newCriteria( entityName="User" )
    .gt( "age", ormService.idCast( 30 ) )
    .isTrue( "isActive" )
    .list( max=30, offset=10, sortOrder="lname" );

Criteria Queries

These methods allows you to tap into the Criteria Queries API so you can do fluent and functional queries with your ORM objects.