A note on its age. The book was written in 2011 for ColdFusion 9, the first version with Hibernate built in. Later versions of ColdFusion and Lucee have changed some details, but the core ideas — mapping, relationships, sessions, HQL and caching — still apply.
Foreword
“This is a book that every ColdFusion programmer should have on his or her shelf. I know I am glad to have it on mine.”
Bob Silverberg
What’s inside
16 chapters, from first mapping to caching
Preface4
- Requirements
- What is ORM?
- What is Hibernate?
- Book Conventions
1. Getting Started7
- Configuring ORM in your Application
- Mapping Tables to Objects
- Allow ColdFusion to Modify the Database
- ORMReload
- Generating Database Schema
- Data Types and Precision
- Annotations
2. ORM is CRUD13
- Creating Records
- Disabling setters
- EntityNew
- EntitySave
- Reading data
- EntityLoad
- Reading Individual Records by ID
- EntityLoadByPK
- Loading Filtered Data
- Ordering Data
- Displaying data
- Updating Existing Data
- Deleting Records
3. ORM Sessions6
- What are ORM Sessions?
- The FlushAtRequestEnd Setting
- ORMFlush
- ORMClearSession
- Transactions
- Transactions in ColdFusion 9.0.0
4. Relationships9
- One-to-Many Relationships
- Many-to-One Relationships
- Many-to-Many Relationships
- One-to-One Relationships
- Generated Methods for Handling Relationships
- The Singularname attribute
- Adding & Removing Entities
- Choosing the Sort Order
- Handling Nulls
5. Bi-Directional Associations5
- Uni-Directional versus Bi-Directional
- Managing Relationships
- SQLIntegrityConstraintViolationException
- The inverse attribute
- Inverse and Many-to-Many
6. Cascading7
- Cascade Types
- Cascade None
- Cascade Delete Type
- Cascade Save-update Type
- Cascade All Type
- Cascade Delete-orphan Type
- Cascade All-delete-orphan Type
7. HQL9
- Getting Started With HQL
- Using a Where Clause
- Named Parameters
- Positional Parameters
- Nicer Looking HQL
- Using Operators in HQL
- Using Functions in HQL
- Relationships in HQL
- Selecting Properties
8. Debugging6
- Logging with ColdFusion Builder's Console View
- Running ColdFusion from a Console
- Viewing parameter values
- Logging to a File
- Viewing HQL Statements in Inline Debugging
- Getting HQL using Hibernate Statistics
9. Computed Properties3
- Using Formulas
- EntityReload
- Where Filter
10. Event Handlers4
- The Global Event Handler
- Entity Event Handlers
- Event Handler Methods
- Practical Examples
11. Improving Performance9
- Paging
- Maxresults
- Offset
- Lazy Loading
- The n+1 Selects Problem
- Fetch="join"
- Fetch with HQL
- Batch Fetching
- ORM Settings
12. Caching10
- First-Level Cache
- Second-Level Cache
- What's Cached?
- Caching Associated Entities
- Managing the cache
- ORMEvictEntity
- ORMEvictCollection
- ORMEvictQueries
- Bulk Operations
- Choosing the Cache Provider
13. Validation4
- Client-side Validation
- Server-side Validation
- ORM Validation
- Validation Framework Integration
14. Advanced Mapping15
- DataTypes and Precision
- The ormtype attribute
- Specifying Length, Nullable and more
- The column attribute
- Dbdefault attribute
- Length attribute
- Notnull attribute
- Precision attribute
- Scale attribute
- Sqltype attribute
- Unique attribute
- Uniquekey attribute
- Naming Strategy
- In-Built Naming Strategies
- Using Your Own Naming Strategy
15. Schema Generation Revisited9
- Advanced Schema Generation
- Inheritance Mapping
- One Table Per Persistent Entity
- One Table Per Persistent CFC With Discriminator
- One Table per Hierarchy
- HQL and Inheritance
- Using Collections Instead of Arrays
- Getting an Entity from a Collection
- The Inverse Attribute
16. Tips, Tricks & Gotchas13
- Populate Using the EntityNew Constructor
- HQL IN Clause
- Refactoring to ORM with EntityToQuery
- Detecting Changes
- Multiple Datasources
- Non Persisted Properties
- Entities with the same name
- Hibernate Statistics
- Constructor Arguments
- Detached Entities
- WriteDump causes ColdFusion to Crash
- Cached MetaData
- Generated Has Methods and Non-Persisted Entities
Appendix7
- Quick Mapping Reference
- Relationships
- Setting up an Apache Derby Database
- References
- Hat Tips
- Where Next?
- And Finally…
Reviews
What readers said
“Finished reading @aliaspooryorik’s awesome book on #ColdFusion ORM. This is a must read for any CF developer.”
“Essential reading for ORM newbies as well as the more experienced.”
“It’s more than worth the money, especially for people who are just starting to get serious about Hibernate.”
“Awesome book, makes this topic approachable, what a difference this makes thank you :)”
“I’m about a quarter of the way through the book and so far it’s fantastic. I’ve read bits and pieces about ORM before, but nothing that explains the basic concepts better than this.”
“Very good so far, and highly recommended to anyone wanting to know more.”
Happy reading
Thanks to everyone who bought the book over the years. It’s yours to read for free now.