Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Features
: Introduction of the automatic resource handler for ORM Entities based on ColdBox's 6 resources and RestHandler
Improvement
: Natively allow for nested transactions and savepoints by not doing preemptive transaction commits when using transactions.
Bug
: Fix on getOrFail()
where if the id was 0, it would still return an empty object.
Task
: Added formatting via cfformat
You can read more about the RESTFul Resources here:
In this section you will find the release notes for each version we release under this major version. If you are looking for the release notes of previous major versions use the version switcher at the top left of this documentation book. Here is a breakdown of our major version releases.
A complete rewrite of the module to support a more modern and fluent approach to working with Hibernate/ColdFusion ORM. In this release we had to support 3 versions of Hibernate: 3 (Lucee), 4 (ACF 2016) and 5 (ACF 2018), which in itself proved to be a gargantuan task.
We also focused on bringing more functional programming aspects to working with collections of entities and even introduced cbStreams as part of the cborm module. This gives you the ability to produce streams out of any method that produces a collection of entities.
We also focused on converting the state of an object graph to a raw ColdFusion data struct as we live in the world of APIs. We include the mementifier module which allows every single entity to have a getMemento()
method that will convert itself and its relationships to raw CF data constructs so you can take that state and either marshall it to another format (json,xml,excel) or audit the state.
The first version of the cbORM series that focused on expanding the native ColdFusion ORM methods and exposing much more Hibernate functionality to the CFML world.
You will need to move the orm
configuration structure in your config/ColdBox.cfc
to the moduleSettings
struct and rename it to cborm
to standardize it to module settings.
deleteByQuery()
reworked entirely to do native bulk delete queries. It now also returns the number of records removed
The evict()
method was renamed to evictCollection()
to better satisfy the same contract in hibernate
The evictEntity()
method was renamed to evict()
to better satisfay the same contract in hibernate
Removed byExample
on many listing methods
Mementifier is now a dependency for cborm (www.forgebox.io/view/mementifier), which can be used for producing state out of ORM entities for auditing or building JSON Api's.
cbStreams is now a dependency for cborm (www.forgebox.io/view/cbstreams), all criteria queries and major listing methods support the return of streams instead of array of objects
Full Null Support
Performance update on creating active entities as datasource discovery has been reworked
Updated build process to latest in Ortus template
Dropped Railo, Lucee 4.5, ACF11 support
More direct scoping for performance updates
Optimized EventHandler so it is lighter and quicker when doing orm injections
Documented all functions with extra examples and notes and hibernate references
ColdBox 5 and 4 discrete ORM Injection DSLs
They have been adapted to work with Hibernate 3, 4 and 5
New fail fast method for get()
-> getOrFail()
to throw an entity not found exception
New alias methods for controlling the result transformations asStruct(), asStream(), asDistinct()
that will apply result transformers for you instead of doing .resultTransformer( c.ALIAS_TO_ENTITY_MAP )
, whish is long and boring, or return to you a java stream via cbStreams.
When calling native restrictions, no more reflection is used to discover the restriction type thus increasing over 70% in performance when creating criteria queries
You can now negate any criteria restriction by prefixing it with a not
. So you can do: .notEq(), notBetween(), notIsNull(), notIsIn()
and much more.
The list()
method has a new asStream
boolean argument that if true, will return the results as a cbStream. ((www.forgebox.io/view/cbStreams))
New Methods: idCast()
and autoCast()
added for quick casting of values
New method: queryHint()
so you can add your own vendor specific query hints for optimizers.
New method: comment( string )
so you can add arbitrary comments to the generated SQL, great for debugging
sqlRestriction()
deprecated in favor of the shorthand notation: sql()
The sql()
restriction now supports binding positional parameters. You can pass them in an array and we will infer the types: sql( "id = ? and isActive = ?", [ "123", true ] )
. Or you can pass in a struct of {value:"", type:""}
instead:
The available types are the following which match the Hibernate Types
Detached Criteria builder now has a maxResults( maxResults )
method to limit the results by
Detached Criteria sql projections now take aliases into account
SQL Projections and SQL Group By projections now respect aliases
New Fail fast methods: getOrFail() proxies to get(), findOrFail() proxies to findIt()
that if not entity is produced will throw a EntityNotFound
exception
All listing methods can now return the results as a cbStream by passing the asStream
boolean argument.
Removed criteriaCount(), criteriaQuery()
from BaseService, this was the legacy criteria builder approach, please use newCriteria()
instead.
Update getEntityGivenName
to support ACF2018
Lazy loading BeanPopulator
for performance on creations
Lazy loading ORMEventHandler
for performance on creations
Lazy loading restrictions
for performance on creations
Base service can now be initialized with a datasource
, or uses the default one declared
Added optional datasource
to many listing methods
Added consistency on querying options to all major functions to include ignoreCase, sorting and timeouts
.
Added ability to getAll()
to retrieve read only entities using the readOnly
argument.
The getAll()
method has a new properties
argument that if passed will allow you to retrieve an array of structs according to the passed in properties.
New method: idCast( entity, id )
to auto cast your entity id
value to java type automatically for you, no more javacasting
New method: autoCast( entity, propertyName, value )
to auto cast any value for any entity property automatically, no more javacasting.
New method: getKeyValue( entity )
which will give you the value of the entity's unique identifier
New method: isDirty( entity )
which will let you know if the entity has dirty values or has its values changed since loaded from the db
New method: getEntityMetadata( entity )
which will return to you the hibernate's metadata for a specific entity.
getPropertyNames()
argument of entityname
renamed to entity
to allow not only for a name but an actual entity as well.
getTableName()
argument of entityname
renamed to entity
to allow not only for a name but an actual entity as well.
getKey()
argument of entityname
renamed to entity
to allow not only for a name but an actual entity as well.
ORM Encapsulation of hibernate metadata retrieval via getEntityMetadata()
deleteByQuery()
reworked entirely to do native bulk delete queries. It now also returns the number of records removed
deleteWhere()
missing flush argument, added datasource as well
New properties: wirebox
: a WireBox reference already injected, logger
: a prepared logger for the class, datasource
The default datasource or constructed datasource for the class.
Logging of all activity now available via the debug
level, even for dynamic methods.
Refactored all dynamic finders and counters to their own class, which improves not only performance but weight of orm service based entities.
All dynamic method calls can now return cbStreams as the results
All dynamic method calls accept a structure as an argument or named as options
that can have the following keys now:
All dynamic finders/counters values are autocasted, you no longer need to cast the values, we will do this for you. You can turn it off via the autocast:false
in the options to the calls.
Remember this entity extends Base Service, so we get all the features above plus the following:
Remember this entity extends the Virtual Service, so we get all the features above plus the following:
Faster creation speeds due to lazy loading of dependencies and better datasource determination.
refresh(), merge(), evict()
refactored to encapsulate login in the base orm service and not itself
This release not only has some bug fixes but several new features that pack a punch.
when()
How many times have you been dealing with if statements in order to add some restrictions into your criteria object? Many, this was the only way before, not anymore. So instead of doing something like the following:
This looks like normal code, but we can do a more functional approach by introducing the when()
function:
This function takes in as the first argument a boolean value, if the value is true, then the target closure will be called for you and the criteria will be passed via the arguments scope:
This construct will help you create more fluent designs when building criteria queries, enjoy!
peek()
We have also enhanced the criteria queries with a peek() function which allows you to peek in the current position of the criteria build up. This allows you to debug or inspect the SQL/HQL inside the criteria at that point in time. You can use it for sending debug data or logging, or auditing.
Enjoy your peekaboo function!
We have added a new function on the ActiveEntity object to assist with validations. The validateOrFail()
function will allow you to validate the entity and if it validates it just returns the instance of the entity for a nice fluent design. However, if the validation fails, it throws a ValidationException
and the errors are passed to the exception object via the extendedInfo
key. You can then deal with the exception as needed.
Features
: New function for criteria query when( boolean, target )
that you can use to build functional criterias without the use of if statements.
Feature
: Missing nullValue()
is BaseBuilder class
Feature
: Added new criteria query peek( closure )
function to allow for peeking into the building process. Pass in your closure that receives the criteria and interact with it.
Feature
: Added a validateOrFail()
to the active entity, which if the validation fails it will throw an exception or return back to you the same entity validated now.
Improvement
: Better documentation for deleteById()
since it does bulk deletion, which does not do any type of cascading.
Improvement
: isValid()
in active entity missing includeFields
argument
Improvement
: Timeout hints for criteria builder
Improvement
: Updated exception type for criteria builder get()
Bug
: ACF2016 issues with elvis operator.
Bug
: getOrFail()
had an invalid throw statement