All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
4.4.0 - 2023-04-19
- Github Actions updated
- Github support files
- ColdBox 7+ automated testing
- More test scenarios and test cleanups
- Removal of
lazy
annotations that conflict with cb7 lazy properties
- Updated
processState()
toannounce()
on all tests
- Updated
processState()
toannounce()
to stay compliant
- Updated
announceInterception()
toannounce()
to stay compliant
- Updated the way the populator is retrieved so we can be forwards compatible
- Upgraded all dependencies to major bumps
- Dropped ACF2016 Support
- New
when( boolean, success, fail )
fluent construct forActiveEntity
,VirtualEntityService
and theBaseORMService
to allow for fluent chaining of operations on an entity or it's service. - Migration to new ColdBox Virtual App Testing approaches
- Removed unecessary on load logging to increase performance
- Hibernate 5.4 on Lucee experimental testing
countWhere()
invalid SQL exception if no arguments are provided: coldbox-modules#54
- CBORM-32 - Non-Primary DSN Entities not found. Multi-datasource discovery of entities using virtual services and active entity. This was a regresion since version 1.5. This brings back multi-datasource support for active entity, and virtual entity services. coldbox-modules#52
- Detached
Subqueries
was marked as a singleton when indeed it was indeed a transient. This could have created scoping issues on subquery based detached criteria building. - Varscoping issues in
BaseBuilder
detached projections DetachedCriteriaBuilder
was not passing thedatasource
to native criteria objects
- Root
docker-compose.yml
to startup MySQL, or PostgreSQL in docker, for further hacking and testing. - Java proxy caching to avoid Lucee OSGi issues and increase Java object building performance
- New method in the BaseOrmService:
buildJavaProxy()
which leverages ourJavaProxyBuilder
- Lazy loading of SQL Helper in criteria queries
- New module template guidelines and CI
- Leverage WireBox aliases for contstruction of internal objects
- Tons of internal docs and links to hibernate docs
- CBORM-29 Allow SQL projections to be functions containing commas
- Removed usage of interface on DSL. Causes more issues than anything with multiple engines.
- Renamed default object DSL
- Removed usage of interface on DSL. Causes more issues than anything with multiple engines.
- CBORM-20 ActiveEntity
evict()
had the wrong method and arguments delegated to the parent class. - CBORM-9 ACF2021 - org.hibernate.SessionFactory.getAllClassMetadata is no longer supported
- CBORM-14 Inline datasource discovery in base orm service to get a performance boost
- CBORM-13 virtual entity service double creating the orm utility, use the parent one instead of duplicating the effort
- CBORM-12 Lazy load the getORMUtil() and use it only when required.
- CBORM-22 New orm util support method: setupHibernateLogging() thanks to michael born
- CBORM-19 Added a
isInTransaction()
util helper method to all the orm services. - CBORM-18 New ORM events based on Hibernate 5.4 Events:
ORMFlush, ORMAutoFlush, ORMPreFlush, ORMDirtyCheck, ORMEvict, and ORMClear
- CBORM-17 Hibernate 5.4 support for lucee new extension
- CBORM-16 Adobe 2021 support and testing automations
- CBORM-15 Migration to github actions
- CBORM-11 Allow Criteria Builder Get() and getOrFail() Methods to Return Projection List Properties
- CBORM-21 New cfformating rules
- If you upgrade your lucee ORM extension to use Hibernate 5.4, all positional paramters in HQL using
?
has been deprecated. You will have to use the?x
approach wherex
is a number according to the position in the sql:
// Old Syntax
select p
from Person p
where p.name like ? and p.isStatus = ?
// New Syntax
select p
from Person p
where p.name like ?1 and p.isStatus = ?2
- Support for Adobe 2021 on resource loader
- New
eventPrefix
setting so you can prefix the resource REST CRUD events with whatever you like. - Useful exceptions when
results
struct does not have the required keys - Ability to override the name of the method to use for persistence on the ORM services. Using the
variables.saveMethod
property or thesavemethod
argument. - Ability to override the name of the method to use for deleting entities on the ORM services. Using the
variables.deleteMethod
property or thedeleteMethod
argument. - cbSwagger docs
- Added ACF2016 compatibilities on elvis operator which sucks on ACF2016
- Avoid using member function son some arrays to allow for working with Java arrays
- Wrong object to get the event handler manager when doing execute query calls
- Exposed a
getSQLHelper()
from criterias to allow for usage of formmatting of sql - New interception points:
beforeOrmExecuteQuery, afterOrmExecuteQuery
from the base orm service:executeQuery()
method
- Moved
afterCriteriaBuilderList
event before results conversions
- Env templates using new lucee bundles and mysql 8 support
- New interception point:
afterCriteriaBuilderGet
,beforeCriteriaBuilderGet
called after/before criteriaget()
calls
- Fixed http to https for downloads
- Fixed watcher pathing
- [CBORM-3] - Updated cbValidation to v3 to suppport cbi18n v2
- [CBORM-4] - asQuery update to default it to false
- [CBORM-5] - Document v3 variant in the docs
- [CBORM-6] - Source code cleanups by applying formatting rules
- [CBORM-2] - isDirty() not working with ActiveEntity due to missing entity passed
- Entities are now created, auto-wired and THEN populated when using the
new()
method instead of being auto-wired after population. - Made
processEntityInjection()
public on the ORM Event Handler so it can be reused in other locations processEntityInjection()
returns the passed entity so you can do chaininggetOrFail()
now includes in theextendedInfo
the actual entity that caused the exception- Formatting according to new rules
- Updated changelogs to new standards
- Added auto-publishing of changelogs to github
- Pinning to ColdBox 6 for base testing
- ColdBox 6 graceful shutdowns for tests
- Base Test Case for all tests for faster executions and cleanup due to base reusability
- Typo on
ORMUtilSupport
when detecting datasources, if you passed a default it would never be used postNew
was not using the actual entity name so we where hitting performance on lookups for name- compose relationships was
false
for resource handler and it needed to betrue
- Increased timeouts for tests, due to Adobe issues with long compile times in latest patch levels that suck!
- Unique validator test was clearing the full app scope and trigger multiple testing issues
Features
: Introduction of the automatic resource handler for ORM Entities based on ColdBox's 6 resources and RestHandlerImprovement
: Natively allow for nested transactions and savepoints by not doing preemptive transaction commits when using transactions.Bug
: Fix ongetOrFail()
where if the id was 0, it would still return an empty object.Task
: Added formatting via cfformat
Feature
: Upgraded tocbValidation
2.0.0Feature
: Updated the unique validator to match 2.0.0 standardsFeature
: Upgraded tomementifier
2.0.0
improvement
: InexecuteQuery()
Determine if we are in a UPDATE, INSERT or DELETE, if we do, just return the results instead of a stream or query as the result is always numeric, the rows that were altered.bug
: FixedasStream
typo onexecuteQuery()
bug
: Missing ACF2016 compat on tests
bug
: virtual entity service still hadentity
required for casting methods
-
Feature
: New function for criteria querywhen( boolean, target )
that you can use to build functional criterias without the use of if statements.newCriteria() .when( isBoolean( arguments.isPublished ), function( c ){ // Published bit c.isEq( "isPublished", isPublished ); // Published eq true evaluate other params if( isPublished ){ c.isLt( "publishedDate", now() ) .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) ) .isEq( "passwordProtection","" ); } } ) .when( !isNull( arguments.showInSearch ), function( criteria ){ c.isEq( "showInSearch", showInSearch ); } ) .list()
-
Feature
: MissingnullValue()
is BaseBuilder class -
Feature
: Added new criteria querypeek( closure )
function to allow for peeking into the building process. Pass in your closure that receives the criteria and interact with it. -
Feature
: Added avalidateOrFail()
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 fordeleteById()
since it does bulk deletion, which does not do any type of cascading. -
Improvement
:isValid()
in active entity missingincludeFields
argument -
Improvement
: Timeout hints for criteria builder -
Improvement
: Updated exception type for criteria builderget()
-
Bug
: ACF2016 issues with elvis operator. -
Bug
:getOrFail()
had an invalid throw statement
- Change
populate()
in ActiveEntity so the target is the last argument so you can just pass a struct as the first argument #29 - Make the
save()
operation return the saved entity or array of entities instead of the BaseORM service #28
- You will need to move the
orm
configuration structure in yourconfig/ColdBox.cfc
to themoduleSettings
struct and rename it tocborm
to standardize it to module settings.
moduleSettings = {
cborm = {
inject = {
enabled = true,
includes = "",
excludes = ""
}
}
};
deleteByQuery()
reworked entirely to do native bulk delete queries. It now also returns the number of records removed- The
evict()
method was renamed toevictCollection()
to better satisfy the same contract in hibernate - The
evictEntity()
method was renamed toevict()
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 newasStream
boolean argument that if true, will return the results as a cbStream. ((www.forgebox.io/view/cbStreams)) - New Methods:
idCast()
andautoCast()
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:
restrictions.sql( "userName = ? and firstName like ?", [
{ value : "joe", type : "string" },
{ value : "%joe%", type : "string" }
] );
The available types are the following which match the Hibernate Types
this.TYPES = {
"string" : "StringType",
"clob" : "ClobType",
"text" : "TextType",
"char" : "ChareacterType",
"boolean" : "BooleanType",
"yesno" : "YesNoType",
"truefalse" : "TrueFalseType",
"byte" : "ByteType",
"short" : "ShortType",
"integer" : "IntegerType",
"long" : "LongType",
"float" : "FloatType",
"double" : "DoubleType",
"bigInteger" : "BigIntegerType",
"bigDecimal" : "BigDecimalType",
"timestamp" : "TimestampType",
"time" : "TimeType",
"date" : "DateType",
"calendar" : "CalendarType",
"currency" : "CurrencyType",
"locale" : "LocaleType",
"timezone" : "TimeZoneType",
"url" : "UrlType",
"class" : "ClassType",
"blob" : "BlobType",
"binary" : "BinaryType",
"uuid" : "UUIDCharType",
"serializable" : "SerializableType"
};
- 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 aEntityNotFound
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 usenewCriteria()
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 thereadOnly
argument. - The
getAll()
method has a newproperties
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 entityid
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 ofentityname
renamed toentity
to allow not only for a name but an actual entity as well.getTableName()
argument ofentityname
renamed toentity
to allow not only for a name but an actual entity as well.getKey()
argument ofentityname
renamed toentity
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 removeddeleteWhere()
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:
{
ignoreCase : boolean (false)
maxResults : numeric (0)
offset : numeric (0)
cacheable : boolean (false)
cacheName : string (default)
timeout : numeric (0)
datasource : string (defaults)
sortBy : hql to sort by,
autoCast : boolean (true),
asStream : boolean (false)
}
results = ormservice.findByLastLoginBetween( "User", "01/01/2008", "11/01/2008", { sortBy="LastName" } );
- 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
- Performance improvements for criteria building as we now build up the dialect and support structs
- ACF 2018 Support via Hibernate 5
- Update to leverage new module template schema
- Updated readme from old text
- ColdBox 5 Support
- Dependency updates
- Some syntax updates
- Fix
getKey()
return typing to allow composite keys: coldbox-modules#21 - Update to module standard template
- Updated dependencies
- Pass the target value as the rejected value for Unique validator
- Travis Updates
- Dependency updates
- Lucee 5 exceptions on ORM Util due to abstract keyword
- Travis updates
- COLDBOX-460 Dynamic finders fixed by always adding datasource attribute to hql query
- Fixes an interface error on AC11 startup
- Fixed box.json version number
- BaseORMService.merge doesn't seem to merge entities back into session #10
- Variable scoping in SQLHelper.cfc bug #9
- Update build process to leverage Travis
- Updated
cbvalidation
to v1.1.0 - Build cleanup
- Replaced
StringBuffer
withStringBuilder
for performance
- Updated cbvalidation dependency
- Prevent conditionals from being stripped from property names
- Updated build for api docs and commandbox usage for dependencies
- ORM Unique validation not working
- updates to all dependencies
- production ignore lists
- https://ortussolutions.atlassian.net/browse/CCM-15 CF11Compat - arrayContainsNoCase() Is not a function
- Lucee support
- Create first module version