SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
ColdFusion ORM
More awesome than a dinosaur riding a shark with a laser!
With pink unicorns!
WHO AM I?
• Luis Majano - Computer Engineer
• Imported from El Salvador----------->
• Architecture + Software Design
• CEO of Ortus Solutions
• Adobe Community Professional
• Creator of all things Box: 

ColdBox, ContentBox,
CommandBox,WireBox….
AGENDA
• Thought experiment
• Silver Bullet
• Benefits
• Advice from Special Guest
• Specialized ORM Services
Thought experiment?
CF ORM was
easier to use?
OO way to
query
ORM was fast
80% of API
Querying
Extensible
way to finish
the remaining
20%
I ate too much
today!
Auto build
relationships
CONCLUSIONS
• Can’t or doesn’t exist
• Sounds like bull…..
• What’s this latino up to? Is he trying to get my money
PROVE IT!
ORM is NOT a silver bullet
• Just another tool
• Times you need the power of the database: reports, legacy, sp, etc.
• Mix and match
• What if you wanted array of structs, or lists or queries or arrays of data?
• There is a learning curve, but it is worth the investment
Applied Benefits
• Increase in productivity of about 40%
• Rich Object Models
• Deliver DB patching updates
• Increased Flexibility
• Great for abstracting vendor specific
intricacies
• OO Queries
• Avg JDBC <10ms of about 350K
Transactions
How do we start?
coldfusionormbook.com amazon
Guru ORMLui
10 keys to ORM Success!
#1: OO Modeling is Key
• ORM relationship modeling is key
• OO is required
• UML is your best friend
• STOPTHINKING ABOUT DATA
• YOU ARE NOT MODELING A DATABASE
#1: OO Modeling is Key
#1: OO Modeling is Key
Query Object
Data Data + Behavior
#2: Engine Defaults Not Great!
• Do not use the CF engine defaults:
• FlushAtRequestEnd (false)
• Send to Database no matter what
• AutoManageSession (false)
• Use transaction demarcations
• Cascade
• Lazy
• Batches
• Caching
• Relationship Fetching (Many to One - Select instead of Join)
• Dialect (Choose it if possible)
#2: Engine Defaults Not Great!
• cfclocation
• Use it to a specified directory, else pay the price
• logSQL
• Great for debugging, OFF for production, else pay the price
• Having Issues?
• saveMapping
• DataBoss - ortussolutions.com/products/databoss
#3: Understand Hibernate Session
• Not the same as session scope
• A transitionary space
• entityLoad()
• entityNew() ?
• A caching layer
• You need to control when to send to DB
• You can remove entities from it and clear it
• You can attach a secondary cache to it
#3: Understand Hibernate Session
Hibernate Session 

(Conversation - Request)
DB
Eu
Ex EzEy
Cache
ehCache/
Couchbase
Batched SQL
EntityNew()
EntityLoad()
Data (!CFCs)
Hibernate Session
Factory (application)
CRUD
When?
ORMClearSession()
#3: Understand Hibernate Session
DB	Sync
Insertions	in	order
updates
Collection	deletions
collection	deletion,	updates,	inserts
collection	insertions
deletions	in	order
#4:Transaction Demarcation
• Transactions demarcate SQL boundaries
• Important Imperative for ORM + SQL
• No communication to DB should occur without one
• Reactive programming, expect the worst
• cftransaction or Hibernate transactions
#4:Transaction Demarcation
• Transaction Theory:
• Any existing ORM session is flushed and reused
• Data can be committed or rollback
• ORMFlush() does not work in a transaction block
• If commit, then flushed to database
• If rollback, session is cleared
#5: Lazy Loading is KEY
• You will fail if you do not use this!
• Performance will SUCK!
• Always Use It!
• LazyTypes:
• True = Only when you call getXX (all types)
• Extra = Loads proxy objects with primary keys only (o-2m,m-2-m)
• Proxy = Loads proxy object with primary key only (o-2-o, m-2-o)
• fetch=“join”
• Uses a single SQL query, great for performance
• batchsize
• For performance, like pagination for objects
#6:Avoid bi-directional
• They can be more of a headache
• Cascading Deletes
• Inverse
• Does it make sense?
• Supporting methods for bi-directional linkage
• Supporting methods for un-linkages
#6:Avoid bi-directional
#6:Avoid bi-directional
#7: Do not store entities in scopes
• Don’t do it!
• No linkage to Hibernate Session
• Relationships will fail if not lazy
• entityMerge()
• Store ID’s instead
#8: Use DB Indexes
• #1 Performance Problem
• Identify relationships
• Identify HQL, SQL
• Learn them
• property name=“isActive” index=“idxActive”
#9: Cache = BOOST!
• Don’t go cache crazy
• Develop a strategy
• Does not store CFC, stores individual property values
• Use distributed caches: ehcache, couchbase
• You can cache:
• Entity property data : Only caches properties data values
• Entity association data : Only caches primary keys
• Query data : HQL, ORMExecuteQuery()
• Evictions:
• ORMEvictEntity(), ORMEvictCollection()
#10: OO Modeling is Key
• ORM relationship modeling is key
• OO is required
• UML is your best friend
• STOPTHINKING ABOUT DATA
• YOU ARE NOT MODELING A DATABASE
ORM Module
install cborm
ORM Module
Base ORM Service
Virtual ORM Service
Active Entity
Entity Populators
Validation
Event Handlers

DI/AOP
Base ORM Service
• Service layer for any entity
• OO Querying, caching, transactions
• Dynamic finders, getters, counters
• Object metadata & session management
• Exposes more features from Hibernate
• 90% Foundation
• Extends Base ORM Services
• Roots itself to a single entity =
LessTyping
• You can build the 10%
Virtual/Concrete ORM
Services
• Active Record Pattern
• Sweet validation integration
• DI/AOP Available
Active Entity
• Populate Entities: xml, json, queries, structs
• Compose relationships from simple values
• Null support
• Exclude/include fields
• Server side validation
• Dependency Injection Listeners
• Custom Event Driven Programming
Entity Populators
Validation
Event Handlers
ORM Utilities
ORM Services in Action
box install cartracker-demo
Base ORM Service
• count(), countWhere()
• delete(), deleteAll(), deleteByID(), deleteByQuery(), delete Where()
• evict(), evictEntity(), evictQueries()
• executeQuery(), list()
• exists()
• findAll(), findAllWhere(), findByExample(), findIt(), findWhere()
• get(), getAll(),
• getKey(), getPropertyNames(), getSessionStatistics(), getTableName()
• clear(), merge(), new(), refresh()
• populate(), populateFromJSON(), populateFromXML(), populateFromQuery()
• save(), saveAll()
Base ORM Service
Dynamic Finders/Counters
• Expressive Programming
• Three types of dynamic Finders/Counters
• findBy : find ONE entity
• findAllBy : find ALL entities
• countBy: Give you a count
Base ORM Service
Dynamic Finders/Counters
• Method Expressions
• Conditionals
• LessThanEquals, LessThan
• GreaterThanEquals, GreaterThan
• Like
• Equal, NotEqual
• isNull, isNotNull
• Between, NotBetween
• inList, notInList
• Operators
• And
• Or
• Query Options
• ignoreCase, timeout, max, offset
• cacheable, cachename
Criteria Builder
Awesome OO Queries
Criteria Builder
• Limitations of CF ORM:
• entityLoad() has limited features
• Some operations we always need an entity = slow
• What if I want arrays, or arrays of structs
• Complex relationships are hard to query
• SQL/HQL string build is so 90’s == NOT FUN!
Criteria Builder
• Programmatic DSL Builder
• Rich set of criterias
• Projections and Result transformations
• Subqueries
• Caching
• SQL Inspections & Debugging
• Array of structures is twice as fast as queries
Criteria Builder
Criteria Builder
• Request new criteria
• newCriteria()
• Add simple restriction(s)
• Find all cars sold between April and July
• Use between()
• Get results
• Use list( max, offset, timeout, sortOrder, ignoreCase, asQuery )
• Get counts
• Use count()
Criteria Builder
Restrictions
• between()
• eq()
• gt()
• ge()
• gtProperty()
• isEmpty()
• isNull()
• ne()
• ilike()
• and()
• or()
• not()
• conjunction()
• disjunction()
• isTrue()
• isFalse()
• sqlRestriction()
• ...much more!
Criteria Builder
Retrievals
• Retrieval
• firstResult()
• get()
• list()
• count()
• Options
• fetchSize()
• readOnly()
• maxResults()
• cache(), cacheRegion()
• timeout()
• order()
Criteria Builder
Aliases -> Joins
• Allows you to do queries within
relationships
• Creates SQL Joins
• Aliases can be nested, so if your entity
knows about it, you can query it!
Criteria Builder
Projections
• Projects change nature of results
• Arrays of data, or arrays of structs (Mighty Fast)
• Once its added its there forever
• avg
• count
• countDistinct
• distinct
• groupProperty
• max
• min
• property
• sum
• rowCount
• id
• sqlProjection
• sqlGroupProjection
• detachedSQLProjection
Criteria Builder
Debugging + Logging
• Application.cfc
• ormsettings.logsql = Never in production
• Criteria Builder SQL Inspector
• startSQLLog( returnExecutableSQL, formatSQL )
• stopSQLLog()
• getSQLLog()
• getSQL( returnExecutableSQL, formatSQL )
Thanks!
Q & A
ortussolutions.com/odw

Mais conteúdo relacionado

Mais procurados

Hibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance TechniquesHibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance TechniquesBrett Meyer
 
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateEffiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateThorben Janssen
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with JavascriptAkshay Mathur
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングscalaconfjp
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextMugunth Kumar
 
Elasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English versionElasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English versionDavid Pilato
 
Hibernate Performance Tuning @JUG Thüringen
Hibernate Performance Tuning @JUG ThüringenHibernate Performance Tuning @JUG Thüringen
Hibernate Performance Tuning @JUG ThüringenThorben Janssen
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaWO Community
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewBrett Meyer
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure DataTaro L. Saito
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of JavascriptTarek Yehia
 
The power of datomic
The power of datomicThe power of datomic
The power of datomicKonrad Szydlo
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engineWO Community
 

Mais procurados (20)

CDI 2.0 Deep Dive
CDI 2.0 Deep DiveCDI 2.0 Deep Dive
CDI 2.0 Deep Dive
 
Hibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance TechniquesHibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance Techniques
 
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateEffiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with Javascript
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Working with GIT
Working with GITWorking with GIT
Working with GIT
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreText
 
Elasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English versionElasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English version
 
Hibernate Performance Tuning @JUG Thüringen
Hibernate Performance Tuning @JUG ThüringenHibernate Performance Tuning @JUG Thüringen
Hibernate Performance Tuning @JUG Thüringen
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Gaej For Beginners
Gaej For BeginnersGaej For Beginners
Gaej For Beginners
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate Overview
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
The power of datomic
The power of datomicThe power of datomic
The power of datomic
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engine
 
Orm loveandhate
Orm loveandhateOrm loveandhate
Orm loveandhate
 
jQuery Objects
jQuery ObjectsjQuery Objects
jQuery Objects
 

Destaque

Destaque (20)

Welcome
WelcomeWelcome
Welcome
 
Creating a Drop Shadow
Creating a Drop ShadowCreating a Drop Shadow
Creating a Drop Shadow
 
მუქარა
მუქარამუქარა
მუქარა
 
ITB2016 - Integration testing in a modern world
ITB2016 - Integration testing in a modern worldITB2016 - Integration testing in a modern world
ITB2016 - Integration testing in a modern world
 
Олі Мельник
Олі МельникОлі Мельник
Олі Мельник
 
Planning booklet
Planning bookletPlanning booklet
Planning booklet
 
Breaking wifi-faster
Breaking wifi-fasterBreaking wifi-faster
Breaking wifi-faster
 
Asdfghjkl
AsdfghjklAsdfghjkl
Asdfghjkl
 
Building Advanced RESTFul services
Building Advanced RESTFul servicesBuilding Advanced RESTFul services
Building Advanced RESTFul services
 
Presentation1 achu 2
Presentation1 achu 2Presentation1 achu 2
Presentation1 achu 2
 
ITB2016 Converting Legacy Apps into Modern MVC
ITB2016 Converting Legacy Apps into Modern MVCITB2016 Converting Legacy Apps into Modern MVC
ITB2016 Converting Legacy Apps into Modern MVC
 
Conceptos de información-1
Conceptos de información-1Conceptos de información-1
Conceptos de información-1
 
Саші Хортів
Саші ХортівСаші Хортів
Саші Хортів
 
Michael jackson music vid
Michael jackson music vidMichael jackson music vid
Michael jackson music vid
 
ITB2015 - ColdBox 4 MVC Modular Architecture
ITB2015 - ColdBox 4 MVC Modular ArchitectureITB2015 - ColdBox 4 MVC Modular Architecture
ITB2015 - ColdBox 4 MVC Modular Architecture
 
Aritra Final Report Declaration
Aritra Final Report DeclarationAritra Final Report Declaration
Aritra Final Report Declaration
 
ITB2016 - ForgeBox 2 Package Management
ITB2016 - ForgeBox 2 Package ManagementITB2016 - ForgeBox 2 Package Management
ITB2016 - ForgeBox 2 Package Management
 
El Greco
El GrecoEl Greco
El Greco
 
Social Media Strategy: Exploring the Basics
Social Media Strategy: Exploring the Basics Social Media Strategy: Exploring the Basics
Social Media Strategy: Exploring the Basics
 
Ancillary task
Ancillary taskAncillary task
Ancillary task
 

Semelhante a Killing Shark-Riding Dinosaurs with ORM

John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudyJohn Adams
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterJohn Adams
 
Dev nexus 2017
Dev nexus 2017Dev nexus 2017
Dev nexus 2017Roy Russo
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitterRoger Xia
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...smallerror
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...xlight
 
Design for scale
Design for scaleDesign for scale
Design for scaleDoug Lampe
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World DominationcPanel
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisWill Iverson
 
FP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleFP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleChristophe Grand
 
Multithreading and Parallelism on iOS [MobOS 2013]
 Multithreading and Parallelism on iOS [MobOS 2013] Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]Kuba Břečka
 
50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...
50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...
50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...Lucas Jellema
 
hibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfhibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfPatiento Del Mar
 
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 Harness SharePoint and jQuery to Make Dynamic Displays and Applications Harness SharePoint and jQuery to Make Dynamic Displays and Applications
Harness SharePoint and jQuery to Make Dynamic Displays and ApplicationsInnoTech
 
Your backend architecture is what matters slideshare
Your backend architecture is what matters slideshareYour backend architecture is what matters slideshare
Your backend architecture is what matters slideshareColin Charles
 
Design for Scale / Surge 2010
Design for Scale / Surge 2010Design for Scale / Surge 2010
Design for Scale / Surge 2010Christopher Brown
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your WebsiteAcquia
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?DATAVERSITY
 
Test driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDBTest driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDBAndrew Siemer
 

Semelhante a Killing Shark-Riding Dinosaurs with ORM (20)

John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
Dev nexus 2017
Dev nexus 2017Dev nexus 2017
Dev nexus 2017
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Design for scale
Design for scaleDesign for scale
Design for scale
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World Domination
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
 
FP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleFP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit Hole
 
Multithreading and Parallelism on iOS [MobOS 2013]
 Multithreading and Parallelism on iOS [MobOS 2013] Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]
 
50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...
50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...
50 Shades of Data - how, when and why Big, Fast, Relational, NoSQL, Elastic, ...
 
hibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfhibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdf
 
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 Harness SharePoint and jQuery to Make Dynamic Displays and Applications Harness SharePoint and jQuery to Make Dynamic Displays and Applications
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 
Your backend architecture is what matters slideshare
Your backend architecture is what matters slideshareYour backend architecture is what matters slideshare
Your backend architecture is what matters slideshare
 
Design for Scale / Surge 2010
Design for Scale / Surge 2010Design for Scale / Surge 2010
Design for Scale / Surge 2010
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
 
Test driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDBTest driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDB
 

Mais de Ortus Solutions, Corp

Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionOrtus Solutions, Corp
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Ortus Solutions, Corp
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfOrtus Solutions, Corp
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfOrtus Solutions, Corp
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfOrtus Solutions, Corp
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfOrtus Solutions, Corp
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfOrtus Solutions, Corp
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfOrtus Solutions, Corp
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfOrtus Solutions, Corp
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfOrtus Solutions, Corp
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfOrtus Solutions, Corp
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfOrtus Solutions, Corp
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfOrtus Solutions, Corp
 
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfOrtus Solutions, Corp
 
ITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfOrtus Solutions, Corp
 
Enterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdfEnterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdfOrtus Solutions, Corp
 

Mais de Ortus Solutions, Corp (20)

Ortus Government.pdf
Ortus Government.pdfOrtus Government.pdf
Ortus Government.pdf
 
Luis Majano The Battlefield ORM
Luis Majano The Battlefield ORMLuis Majano The Battlefield ORM
Luis Majano The Battlefield ORM
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
 
Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusion
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
 
ITB_2023_CBWire_v3_Grant_Copley.pdf
ITB_2023_CBWire_v3_Grant_Copley.pdfITB_2023_CBWire_v3_Grant_Copley.pdf
ITB_2023_CBWire_v3_Grant_Copley.pdf
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
 
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
 
ITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdf
 
Enterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdfEnterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdf
 

Último

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Último (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

Killing Shark-Riding Dinosaurs with ORM

  • 1.
  • 2. ColdFusion ORM More awesome than a dinosaur riding a shark with a laser! With pink unicorns!
  • 3. WHO AM I? • Luis Majano - Computer Engineer • Imported from El Salvador-----------> • Architecture + Software Design • CEO of Ortus Solutions • Adobe Community Professional • Creator of all things Box: 
 ColdBox, ContentBox, CommandBox,WireBox….
  • 4. AGENDA • Thought experiment • Silver Bullet • Benefits • Advice from Special Guest • Specialized ORM Services
  • 5. Thought experiment? CF ORM was easier to use? OO way to query ORM was fast 80% of API Querying Extensible way to finish the remaining 20% I ate too much today! Auto build relationships
  • 6. CONCLUSIONS • Can’t or doesn’t exist • Sounds like bull….. • What’s this latino up to? Is he trying to get my money PROVE IT!
  • 7. ORM is NOT a silver bullet • Just another tool • Times you need the power of the database: reports, legacy, sp, etc. • Mix and match • What if you wanted array of structs, or lists or queries or arrays of data? • There is a learning curve, but it is worth the investment
  • 8. Applied Benefits • Increase in productivity of about 40% • Rich Object Models • Deliver DB patching updates • Increased Flexibility • Great for abstracting vendor specific intricacies • OO Queries • Avg JDBC <10ms of about 350K Transactions
  • 9. How do we start? coldfusionormbook.com amazon
  • 10. Guru ORMLui 10 keys to ORM Success!
  • 11. #1: OO Modeling is Key • ORM relationship modeling is key • OO is required • UML is your best friend • STOPTHINKING ABOUT DATA • YOU ARE NOT MODELING A DATABASE
  • 12. #1: OO Modeling is Key
  • 13. #1: OO Modeling is Key Query Object Data Data + Behavior
  • 14. #2: Engine Defaults Not Great! • Do not use the CF engine defaults: • FlushAtRequestEnd (false) • Send to Database no matter what • AutoManageSession (false) • Use transaction demarcations • Cascade • Lazy • Batches • Caching • Relationship Fetching (Many to One - Select instead of Join) • Dialect (Choose it if possible)
  • 15. #2: Engine Defaults Not Great! • cfclocation • Use it to a specified directory, else pay the price • logSQL • Great for debugging, OFF for production, else pay the price • Having Issues? • saveMapping • DataBoss - ortussolutions.com/products/databoss
  • 16. #3: Understand Hibernate Session • Not the same as session scope • A transitionary space • entityLoad() • entityNew() ? • A caching layer • You need to control when to send to DB • You can remove entities from it and clear it • You can attach a secondary cache to it
  • 17. #3: Understand Hibernate Session Hibernate Session 
 (Conversation - Request) DB Eu Ex EzEy Cache ehCache/ Couchbase Batched SQL EntityNew() EntityLoad() Data (!CFCs) Hibernate Session Factory (application) CRUD When? ORMClearSession()
  • 18. #3: Understand Hibernate Session DB Sync Insertions in order updates Collection deletions collection deletion, updates, inserts collection insertions deletions in order
  • 19. #4:Transaction Demarcation • Transactions demarcate SQL boundaries • Important Imperative for ORM + SQL • No communication to DB should occur without one • Reactive programming, expect the worst • cftransaction or Hibernate transactions
  • 20. #4:Transaction Demarcation • Transaction Theory: • Any existing ORM session is flushed and reused • Data can be committed or rollback • ORMFlush() does not work in a transaction block • If commit, then flushed to database • If rollback, session is cleared
  • 21. #5: Lazy Loading is KEY • You will fail if you do not use this! • Performance will SUCK! • Always Use It! • LazyTypes: • True = Only when you call getXX (all types) • Extra = Loads proxy objects with primary keys only (o-2m,m-2-m) • Proxy = Loads proxy object with primary key only (o-2-o, m-2-o) • fetch=“join” • Uses a single SQL query, great for performance • batchsize • For performance, like pagination for objects
  • 22. #6:Avoid bi-directional • They can be more of a headache • Cascading Deletes • Inverse • Does it make sense? • Supporting methods for bi-directional linkage • Supporting methods for un-linkages
  • 25. #7: Do not store entities in scopes • Don’t do it! • No linkage to Hibernate Session • Relationships will fail if not lazy • entityMerge() • Store ID’s instead
  • 26. #8: Use DB Indexes • #1 Performance Problem • Identify relationships • Identify HQL, SQL • Learn them • property name=“isActive” index=“idxActive”
  • 27. #9: Cache = BOOST! • Don’t go cache crazy • Develop a strategy • Does not store CFC, stores individual property values • Use distributed caches: ehcache, couchbase • You can cache: • Entity property data : Only caches properties data values • Entity association data : Only caches primary keys • Query data : HQL, ORMExecuteQuery() • Evictions: • ORMEvictEntity(), ORMEvictCollection()
  • 28. #10: OO Modeling is Key • ORM relationship modeling is key • OO is required • UML is your best friend • STOPTHINKING ABOUT DATA • YOU ARE NOT MODELING A DATABASE
  • 30. ORM Module Base ORM Service Virtual ORM Service Active Entity Entity Populators Validation Event Handlers
 DI/AOP
  • 31. Base ORM Service • Service layer for any entity • OO Querying, caching, transactions • Dynamic finders, getters, counters • Object metadata & session management • Exposes more features from Hibernate • 90% Foundation
  • 32. • Extends Base ORM Services • Roots itself to a single entity = LessTyping • You can build the 10% Virtual/Concrete ORM Services
  • 33. • Active Record Pattern • Sweet validation integration • DI/AOP Available Active Entity
  • 34. • Populate Entities: xml, json, queries, structs • Compose relationships from simple values • Null support • Exclude/include fields • Server side validation • Dependency Injection Listeners • Custom Event Driven Programming Entity Populators Validation Event Handlers ORM Utilities
  • 35. ORM Services in Action box install cartracker-demo
  • 36. Base ORM Service • count(), countWhere() • delete(), deleteAll(), deleteByID(), deleteByQuery(), delete Where() • evict(), evictEntity(), evictQueries() • executeQuery(), list() • exists() • findAll(), findAllWhere(), findByExample(), findIt(), findWhere() • get(), getAll(), • getKey(), getPropertyNames(), getSessionStatistics(), getTableName() • clear(), merge(), new(), refresh() • populate(), populateFromJSON(), populateFromXML(), populateFromQuery() • save(), saveAll()
  • 37. Base ORM Service Dynamic Finders/Counters • Expressive Programming • Three types of dynamic Finders/Counters • findBy : find ONE entity • findAllBy : find ALL entities • countBy: Give you a count
  • 38. Base ORM Service Dynamic Finders/Counters • Method Expressions • Conditionals • LessThanEquals, LessThan • GreaterThanEquals, GreaterThan • Like • Equal, NotEqual • isNull, isNotNull • Between, NotBetween • inList, notInList • Operators • And • Or • Query Options • ignoreCase, timeout, max, offset • cacheable, cachename
  • 40. Criteria Builder • Limitations of CF ORM: • entityLoad() has limited features • Some operations we always need an entity = slow • What if I want arrays, or arrays of structs • Complex relationships are hard to query • SQL/HQL string build is so 90’s == NOT FUN!
  • 41. Criteria Builder • Programmatic DSL Builder • Rich set of criterias • Projections and Result transformations • Subqueries • Caching • SQL Inspections & Debugging • Array of structures is twice as fast as queries
  • 43. Criteria Builder • Request new criteria • newCriteria() • Add simple restriction(s) • Find all cars sold between April and July • Use between() • Get results • Use list( max, offset, timeout, sortOrder, ignoreCase, asQuery ) • Get counts • Use count()
  • 44. Criteria Builder Restrictions • between() • eq() • gt() • ge() • gtProperty() • isEmpty() • isNull() • ne() • ilike() • and() • or() • not() • conjunction() • disjunction() • isTrue() • isFalse() • sqlRestriction() • ...much more!
  • 45. Criteria Builder Retrievals • Retrieval • firstResult() • get() • list() • count() • Options • fetchSize() • readOnly() • maxResults() • cache(), cacheRegion() • timeout() • order()
  • 46. Criteria Builder Aliases -> Joins • Allows you to do queries within relationships • Creates SQL Joins • Aliases can be nested, so if your entity knows about it, you can query it!
  • 47. Criteria Builder Projections • Projects change nature of results • Arrays of data, or arrays of structs (Mighty Fast) • Once its added its there forever • avg • count • countDistinct • distinct • groupProperty • max • min • property • sum • rowCount • id • sqlProjection • sqlGroupProjection • detachedSQLProjection
  • 48. Criteria Builder Debugging + Logging • Application.cfc • ormsettings.logsql = Never in production • Criteria Builder SQL Inspector • startSQLLog( returnExecutableSQL, formatSQL ) • stopSQLLog() • getSQLLog() • getSQL( returnExecutableSQL, formatSQL )