SlideShare une entreprise Scribd logo
1  sur  74
Télécharger pour lire hors ligne
By Luis Majano
ORM
Battlefield
@lmajano
@ortussolutions
• Salvadorean Born!
• Imported to the USA
• On-loan to Spain!
• Computer Engineering
• CEO of Ortus Solutions
MAJANO
LUIS
CFCASTS
by Ortus Solutions
Learn from the makers of Coldbox, TestBox, and CommandBox through bite-size video tutorials on everything
you need to modernize your CFML development.
Become a CFML master!
Learning
Paths
Real-World
Examples
Engaging and
Interactive
Regularly
Updated Content
Flexible
Learning
Extensive
Course Library:
Watch all new series as they
are released
Access to the entire back catalog
You get 1 month for FREE
YEARLY
$275
Buy series a-la-carte
Access to free videos
Upgrade easily at any time
COMMUNITY
FREE
Watch all new series as they
are released
Access to the entire back catalog
Support Open Source Software
MONTHLY
$25
Why Choose CFCasts?
https://github.com/coldbox-samples/Pink-Unicorns-Do-Exist
Examples
➡ How to use ORM
➡ When to use ORM
➡ Tips & Trips to master Hibernate ORM
➡ Pitfalls to avoid
➡ Architectural overviews of ORM
➡ Extend ORM
Agenda
➡ Object Relational Mapper
➡ Maps:
- Objects to tables
- Properties to columns
- Relationships to foreign keys and tables
➡ An easier way to persist data vs. boring CRUD SQL
➡ Focus on objects instead of data
➡ ColdFusion ORM (Abstraction to Hibernate/JPA)
➡ Almost Everything in Hibernate works in CF
ORM
What is
?
➡ Write less boilerplate boring SQL
➡ Increase in productivity
➡ Rich Object Models
➡ Increased Flexibility
➡ Database vendor abstraction
➡ OO instead of query-based
➡ but…..
BENEFITS
Is it a Silver Bullet?
➡ Just another tool
➡ Times you need the power of the database: reports, legacy, sp, etc.
➡ Mix and Match
➡ There is a learning curve, but it is worth the investment
➡ What if you wanted an array of structs, list queries, or data arrays?
Use it Wisely!
coldfusionormbook.com
Enhance yourself!
coldbox-orm.ortusbooks.com
orm-extension.ortusbooks.com
Database(s)
ORM
CFML Application
Persisted Entities
CFML
Engine
Config Mappings
ORM+
Architecture Qb/CF
SQL
➡ Enabled + Configured via Application.cfc
➡ this.ormEnabled = true;
➡ this.datasource = “MyDatasource”;
➡ this.ormSettings = {}
➡ https://cfdocs.org/ormsettings
ORM
Activating
ORM
Settings
BAD
DEFAULTS
BAD
DEFAULTS
Control Data Flushing + Transaction Borders:
ormsettings.flushAtRequestEnd = false
ormsettings.autoManageSession = false
Control Database Dialects (If Possible)
ormsettings.dialect = “MySQLwithInnoDB”
BAD
DEFAULTS
Control Entity Discovery or pay the price!
ormSettings.cfclocation = [ “/models”, “/ext/entities” ]
Great for debugging, NOT for production!
ormSettings.logSql = false
Need
HELP
Need even more debugging?
- Build out the Hibernate MXML
- Show syntax exceptions
ormSettings.saveMapping = true
ormSettings.skipCFCWithError = false
DataBoss - github.com/coldbox-modules/databoss
$> install databoss
ORM
Entities &
Metadata
Dynamic
Administrator
Inspect, Analyze, Scaffold
Need
HELP
this.ormSettings = {
// Restrict Entity Locations
cfclocation = [ "/models" ],
// Chose the DB Dialect
dialect = "MySQLwithInnoDB",
// Don’t inspect the database
dbcreate = "none",
// Active caching if needed
secondarycacheenabled = false,
cacheProvider = "ehCache",
// Logging only in development
logSQL = env == “dev” ? false : false,
// Session Management: NEVER TRUE
flushAtRequestEnd = false,
autoManageSession = false,
// Event Handling: Yes Please!
eventHandling = true,
eventHandler = "cborm.models.EventHandler",
// Turn on/off skipping of exceptions on syntax: Maybe!
skipCFCWithError = false
};
ORM
Settings
Better
Logging is your best friend, 4EVER!
1. Application.cfc
2. ExtendedLog4j Logging
this.ormSettings = {
// Logging
logSQL = true,
};
WEB-INF/cfusion/lib/log4j.properties
LOGGING
###--------------- Hibernate Log Settings ------
### Set Hibernate log
log4j.logger.org.hibernate=INFO, HIBERNATECONSOLE
### log just the SQL
log4j.logger.org.hibernate.SQL=DEBUG, HIBERNATECONSOLE
log4j.additivity.org.hibernate.SQL=true
### Also log the parameter binding to the prepared statements.
log4j.logger.org.hibernate.type=DEBUG
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=DEBUG, HIBERNATECONSOLE
### log cache activity ###
log4j.logger.org.hibernate.cache=DEBUG, HIBERNATECONSOLE
#---------------------------------------------
WEB-INF/cfusion/lib/log4j.properties
Log4J
Logging
No Object Modeling
#1 Failure
➡ ORM relationship modeling is key
➡ OO is required
➡ UML is your best friend
➡ STOP THINKING ABOUT DATA
➡ YOU ARE NOT MODELING A DATABASE
OO Modeling is Key
OO Modeling is Key
Query Object
Data Data + Behavior
OO Modeling is Key
#2 RELATIONSHIPS
one-to-one
Student Metadata
one-to-many
Student Address
many-to-one
User Role
many-to-many
User Permissions
f
i
eldtype=“”
RELATIONSHIPS
➡ Unidirectional or Bidirectional
➡ Collections can be as arrays or structs
➡ Filtered Collections (Missed by devs)
➡ Performance Failures
➡ Control when they are loaded (lazyness)
➡ Control how many related entities are loaded
➡ Executing code on loading
➡ The hardest part of ORM
RELATIONSHIPS
➡ one-to-many, many-to-many
➡ add<relationship_property_name>(<associated_object>)
➡ boolean remove<relationship_property_name>(<associated_object>)
➡ boolean has<relationship_property_name>(<associated_object>)
➡ many-to-one, one-to-one
➡ boolean has<relationship_property_name>()
• addArts( Art art )
• removeArts( Art art )
• hasArts()
• hasArts( Art art )
property name=“arts"
fieldtype="one-to-many"
cfc="Art"
fkcolumn=“ArtistID";
GENERATED
METHODS
YOU HAVE TO BE
LAZY
➡ Immediate Fetching (Default)
➡ select with left outer join
➡ Use lazy For ALL Relationships or pay the price
YOU HAVE TO BE
LAZY
➡ Three types of laziness values:
lazy=“true”
all relationships
Loads the relationship data when the getter is called (Batches, if used)
lazy=“extra”
one-to-many, many-to-many
Loads proxy light objects with primary keys
(Event better - Batches, if used)
lazy=“proxy”
one-to-one, many-to-one
Loads proxy with primary key (Same as above)
YOU HAVE TO BE
LAZY
➡ Eager Fetching
➡ Mostly used in one-to-one and many-to-one, but applies to all
➡ Default uses 2 SQL queries, reduce to 1 Query
property name=“role” fieldtype=“many-to-one” fetch=“join”;
➡ Batch Fetching
➡ Limits the way relationships are loaded, else Hibernate tries to load all records
➡ Used on many-to-many and one-to-many collection properties:
property name=“comments” fieldtype=“one-to-many” batchsize=“10” lazy=“extra”;
➡ Used at entity level as well:
component name=“Comment” batchsize=10{}
YOU HAVE TO BE
LAZY
Oracle Tip
➡ JDBC Fetch Sizes are defaulted to 10
➡ Slow for many records or batch operations
➡ Increase the JDBC Fetch size
➡ Custom Hibernate setting
hibernate.jdbc.fetch_size=100
YOU HAVE TO BE
LAZY
➡ They can be more of a headache
➡ Cascading Deletes are painful
➡ Choose the controlling relationship
➡ inverse=true
➡ Else double queries, inefficient queries
➡ Does it make sense?
➡ Supporting methods for bi-directional linkage
➡ Supporting methods for un-linkages
AVOID BI-DIRECTIONAL,
IF POSSIBLE!
BETTER Relationships
➡ Not the same as session scope
➡ A transitionary space + Caching Layer
➡ entityLoad()
➡ entityNew() ?
➡ You need to control when to send to DB
➡ transaction{}, ormflush()
➡ You can remove entities from it and clear it
➡ ORMClearSession()
➡ ORMEvictEntity(), ORMEvictCollection()
➡ ORMCloseSession()
UNDERSTAND THE HIBERNATE SESSION
Hibernate Session
(Conversation - Request)
DB
Eu
Ex Ez
Ey
Cache
ehCache/
Couchbase
Batched SQL
EntityNew()
EntityLoad()
Data (!CFCs)
Hibernate Session
Factory (application)
CRUD
When?
ORMClearSession()
UNDERSTAND THE HIBERNATE SESSION
DB
Sync
Insertions in order
updates
Collectiondeletions
collectiondeletion,updates, inserts
collectioninsertions
deletions in order
UNDERSTAND THE HIBERNATE SESSION
➡ 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 raw transactions
TRANSACTION DEMARCATION
➡ Transaction Theory:
➡ Any existing ORM session is flushed and reused
➡ Data can be committed or rollback
➡ ORMFlush() is ignored in transactions
➡ If commit, then flushed to database
➡ If rollback, session is cleared
TRANSACTION DEMARCATION
TRANSACTION DEMARCATION
TRANSACTION DEMARCATION
➡ Don’t do it!
➡ Breaks the link to the Hibernate Session
➡ Relationships will fail if not lazy loaded
➡ entityMerge()
➡ Store ID’s or data instead, then inflate the entities
AVOID SCOPING ENTITIES
➡ #1 Performance Problem
➡ Identify relationships
➡ Identify HQL, SQL
➡ Create indexes!
DATABASE
INDEXES
➡ Don’t go cache crazy, develop a strategy
➡ Misconception: Does not store CFC
➡ Stores individual property values
➡ Use distributed caches: ehcache, couchbase, redis
➡ 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()
CACHE
BOOSTING
CACHE
BOOSTING
CACHE
BOOSTING
➡ The fastest gun in the galaxy!
➡ Return array of structs
➡ Why a full ORM Object graph?
➡ Boost your APIs, stop converting queries/
array of objects to JSON
HQL
MAPS
HQL
MAPS
When is HappyBox?
ORM was fast
Extensible way to finish
the remaining 20%
CF ORM was easier to use?
80% of API Querying
OO way to query
Auto build relationships
ORM
THOUGHTS?
Base ORM Service
Virtual ORM Service
Active Entity
Entity Populators
Validation
Event Handlers
DI/AOP
OVERVIEW
➡ Service layer for any entity
➡ OO Querying, caching, transactions
➡ Dynamic finders, getters, counters
➡ Object metadata & session management
➡ Exposes more features from Hibernate
➡ 90% Foundation
BASE ORM
SERVICE
➡ Extends Base ORM Services
➡ Roots itself to a single entity = Less Typing
➡ You can build the 10%
VIRTUAL
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
box install cartracker-demo.
ORM
SERVICES
IN ACTION
➡ 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
BASE ORM
SERVICE
Dynamic Finders/Counters
➡ Expressive Programming
➡ Three types of dynamic Finders/Counters
➡
fi
ndBy :
fi
nd ONE entity
➡
fi
ndAllBy :
fi
nd ALL entities
➡ countBy: Give you a count
BASE ORM
SERVICE
Dynamic Finders/Counters
➡ 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
AWESOME OO QUERIES
CRITERIA
BUILDER
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
➡ between()
➡ eq()
➡ gt()
➡ ge()
➡ gtProperty()
➡ isEmpty()
➡ isNull()
➡ ne()
➡ ilike()
➡ and()
➡ or()
➡ not()
➡ conjunction()
➡ disjunction()
➡ isTrue()
➡ isFalse()
➡ sqlRestriction()
➡ ...much more!
RESTRICTIONS
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
➡ Criteria Builder SQL Inspector
➡ startSQLLog( returnExecutableSQL, formatSQL )
➡ stopSQLLog()
➡ getSQLLog()
➡ getSQL( returnExecutableSQL, formatSQL )

Contenu connexe

Similaire à Luis Majano The Battlefield ORM

Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeBen Marks
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!mold
 
Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016
Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016
Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016Alluxio, Inc.
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Guatemala User Group
 
Ldap Synchronization Connector @ 2011.RMLL
Ldap Synchronization Connector @ 2011.RMLLLdap Synchronization Connector @ 2011.RMLL
Ldap Synchronization Connector @ 2011.RMLLsbahloul
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Logical-DataWarehouse-Alluxio-meetup
Logical-DataWarehouse-Alluxio-meetupLogical-DataWarehouse-Alluxio-meetup
Logical-DataWarehouse-Alluxio-meetupGianmario Spacagna
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthPhilip Norton
 
Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMark Leith
 
Beat the devil: towards a Drupal performance benchmark
Beat the devil: towards a Drupal performance benchmarkBeat the devil: towards a Drupal performance benchmark
Beat the devil: towards a Drupal performance benchmarkPedro González Serrano
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World DominationcPanel
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentationdidip
 
06 integrating extra features and looking forward
06   integrating extra features and looking forward06   integrating extra features and looking forward
06 integrating extra features and looking forwardМарина Босова
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderSadayuki Furuhashi
 
Scaling With Postgres
Scaling With PostgresScaling With Postgres
Scaling With PostgresRobert Treat
 
ITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cbormITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cbormOrtus Solutions, Corp
 
Bits and Pieces from the UPEI Experience
Bits and Pieces from the UPEI ExperienceBits and Pieces from the UPEI Experience
Bits and Pieces from the UPEI ExperienceEvergreen ILS
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quoIvano Pagano
 

Similaire à Luis Majano The Battlefield ORM (20)

Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento Code
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!
 
Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016
Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016
Accelerating Machine Learning Pipelines with Alluxio at Alluxio Meetup 2016
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Ldap Synchronization Connector @ 2011.RMLL
Ldap Synchronization Connector @ 2011.RMLLLdap Synchronization Connector @ 2011.RMLL
Ldap Synchronization Connector @ 2011.RMLL
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Logical-DataWarehouse-Alluxio-meetup
Logical-DataWarehouse-Alluxio-meetupLogical-DataWarehouse-Alluxio-meetup
Logical-DataWarehouse-Alluxio-meetup
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sys
 
Beat the devil: towards a Drupal performance benchmark
Beat the devil: towards a Drupal performance benchmarkBeat the devil: towards a Drupal performance benchmark
Beat the devil: towards a Drupal performance benchmark
 
Persistence hibernate
Persistence hibernatePersistence hibernate
Persistence hibernate
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World Domination
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentation
 
06 integrating extra features and looking forward
06   integrating extra features and looking forward06   integrating extra features and looking forward
06 integrating extra features and looking forward
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loader
 
Scaling With Postgres
Scaling With PostgresScaling With Postgres
Scaling With Postgres
 
ITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cbormITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cborm
 
Bits and Pieces from the UPEI Experience
Bits and Pieces from the UPEI ExperienceBits and Pieces from the UPEI Experience
Bits and Pieces from the UPEI Experience
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quo
 

Plus 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
 

Plus de Ortus Solutions, Corp (20)

Ortus Government.pdf
Ortus Government.pdfOrtus Government.pdf
Ortus Government.pdf
 
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
 
Into The Box 2023 Keynote day 2
Into The Box 2023 Keynote day 2Into The Box 2023 Keynote day 2
Into The Box 2023 Keynote day 2
 

Dernier

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Dernier (20)

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Luis Majano The Battlefield ORM

  • 2. @lmajano @ortussolutions • Salvadorean Born! • Imported to the USA • On-loan to Spain! • Computer Engineering • CEO of Ortus Solutions MAJANO LUIS
  • 3. CFCASTS by Ortus Solutions Learn from the makers of Coldbox, TestBox, and CommandBox through bite-size video tutorials on everything you need to modernize your CFML development. Become a CFML master! Learning Paths Real-World Examples Engaging and Interactive Regularly Updated Content Flexible Learning Extensive Course Library: Watch all new series as they are released Access to the entire back catalog You get 1 month for FREE YEARLY $275 Buy series a-la-carte Access to free videos Upgrade easily at any time COMMUNITY FREE Watch all new series as they are released Access to the entire back catalog Support Open Source Software MONTHLY $25 Why Choose CFCasts?
  • 5. ➡ How to use ORM ➡ When to use ORM ➡ Tips & Trips to master Hibernate ORM ➡ Pitfalls to avoid ➡ Architectural overviews of ORM ➡ Extend ORM Agenda
  • 6. ➡ Object Relational Mapper ➡ Maps: - Objects to tables - Properties to columns - Relationships to foreign keys and tables ➡ An easier way to persist data vs. boring CRUD SQL ➡ Focus on objects instead of data ➡ ColdFusion ORM (Abstraction to Hibernate/JPA) ➡ Almost Everything in Hibernate works in CF ORM What is ?
  • 7. ➡ Write less boilerplate boring SQL ➡ Increase in productivity ➡ Rich Object Models ➡ Increased Flexibility ➡ Database vendor abstraction ➡ OO instead of query-based ➡ but….. BENEFITS
  • 8. Is it a Silver Bullet? ➡ Just another tool ➡ Times you need the power of the database: reports, legacy, sp, etc. ➡ Mix and Match ➡ There is a learning curve, but it is worth the investment ➡ What if you wanted an array of structs, list queries, or data arrays? Use it Wisely!
  • 11. ➡ Enabled + Configured via Application.cfc ➡ this.ormEnabled = true; ➡ this.datasource = “MyDatasource”; ➡ this.ormSettings = {} ➡ https://cfdocs.org/ormsettings ORM Activating
  • 13. BAD DEFAULTS Control Data Flushing + Transaction Borders: ormsettings.flushAtRequestEnd = false ormsettings.autoManageSession = false Control Database Dialects (If Possible) ormsettings.dialect = “MySQLwithInnoDB”
  • 14. BAD DEFAULTS Control Entity Discovery or pay the price! ormSettings.cfclocation = [ “/models”, “/ext/entities” ] Great for debugging, NOT for production! ormSettings.logSql = false
  • 15. Need HELP Need even more debugging? - Build out the Hibernate MXML - Show syntax exceptions ormSettings.saveMapping = true ormSettings.skipCFCWithError = false
  • 16. DataBoss - github.com/coldbox-modules/databoss $> install databoss ORM Entities & Metadata Dynamic Administrator Inspect, Analyze, Scaffold Need HELP
  • 17. this.ormSettings = { // Restrict Entity Locations cfclocation = [ "/models" ], // Chose the DB Dialect dialect = "MySQLwithInnoDB", // Don’t inspect the database dbcreate = "none", // Active caching if needed secondarycacheenabled = false, cacheProvider = "ehCache", // Logging only in development logSQL = env == “dev” ? false : false, // Session Management: NEVER TRUE flushAtRequestEnd = false, autoManageSession = false, // Event Handling: Yes Please! eventHandling = true, eventHandler = "cborm.models.EventHandler", // Turn on/off skipping of exceptions on syntax: Maybe! skipCFCWithError = false }; ORM Settings Better
  • 18. Logging is your best friend, 4EVER!
  • 19. 1. Application.cfc 2. ExtendedLog4j Logging this.ormSettings = { // Logging logSQL = true, }; WEB-INF/cfusion/lib/log4j.properties LOGGING
  • 20. ###--------------- Hibernate Log Settings ------ ### Set Hibernate log log4j.logger.org.hibernate=INFO, HIBERNATECONSOLE ### log just the SQL log4j.logger.org.hibernate.SQL=DEBUG, HIBERNATECONSOLE log4j.additivity.org.hibernate.SQL=true ### Also log the parameter binding to the prepared statements. log4j.logger.org.hibernate.type=DEBUG ### log schema export/update ### log4j.logger.org.hibernate.tool.hbm2ddl=DEBUG, HIBERNATECONSOLE ### log cache activity ### log4j.logger.org.hibernate.cache=DEBUG, HIBERNATECONSOLE #--------------------------------------------- WEB-INF/cfusion/lib/log4j.properties Log4J Logging
  • 22. ➡ ORM relationship modeling is key ➡ OO is required ➡ UML is your best friend ➡ STOP THINKING ABOUT DATA ➡ YOU ARE NOT MODELING A DATABASE OO Modeling is Key
  • 24. Query Object Data Data + Behavior OO Modeling is Key
  • 26. one-to-one Student Metadata one-to-many Student Address many-to-one User Role many-to-many User Permissions f i eldtype=“” RELATIONSHIPS
  • 27. ➡ Unidirectional or Bidirectional ➡ Collections can be as arrays or structs ➡ Filtered Collections (Missed by devs) ➡ Performance Failures ➡ Control when they are loaded (lazyness) ➡ Control how many related entities are loaded ➡ Executing code on loading ➡ The hardest part of ORM RELATIONSHIPS
  • 28. ➡ one-to-many, many-to-many ➡ add<relationship_property_name>(<associated_object>) ➡ boolean remove<relationship_property_name>(<associated_object>) ➡ boolean has<relationship_property_name>(<associated_object>) ➡ many-to-one, one-to-one ➡ boolean has<relationship_property_name>() • addArts( Art art ) • removeArts( Art art ) • hasArts() • hasArts( Art art ) property name=“arts" fieldtype="one-to-many" cfc="Art" fkcolumn=“ArtistID"; GENERATED METHODS
  • 29. YOU HAVE TO BE LAZY
  • 30. ➡ Immediate Fetching (Default) ➡ select with left outer join ➡ Use lazy For ALL Relationships or pay the price YOU HAVE TO BE LAZY
  • 31. ➡ Three types of laziness values: lazy=“true” all relationships Loads the relationship data when the getter is called (Batches, if used) lazy=“extra” one-to-many, many-to-many Loads proxy light objects with primary keys (Event better - Batches, if used) lazy=“proxy” one-to-one, many-to-one Loads proxy with primary key (Same as above) YOU HAVE TO BE LAZY
  • 32. ➡ Eager Fetching ➡ Mostly used in one-to-one and many-to-one, but applies to all ➡ Default uses 2 SQL queries, reduce to 1 Query property name=“role” fieldtype=“many-to-one” fetch=“join”; ➡ Batch Fetching ➡ Limits the way relationships are loaded, else Hibernate tries to load all records ➡ Used on many-to-many and one-to-many collection properties: property name=“comments” fieldtype=“one-to-many” batchsize=“10” lazy=“extra”; ➡ Used at entity level as well: component name=“Comment” batchsize=10{} YOU HAVE TO BE LAZY
  • 33. Oracle Tip ➡ JDBC Fetch Sizes are defaulted to 10 ➡ Slow for many records or batch operations ➡ Increase the JDBC Fetch size ➡ Custom Hibernate setting hibernate.jdbc.fetch_size=100 YOU HAVE TO BE LAZY
  • 34. ➡ They can be more of a headache ➡ Cascading Deletes are painful ➡ Choose the controlling relationship ➡ inverse=true ➡ Else double queries, inefficient queries ➡ Does it make sense? ➡ Supporting methods for bi-directional linkage ➡ Supporting methods for un-linkages AVOID BI-DIRECTIONAL, IF POSSIBLE!
  • 35.
  • 36.
  • 37.
  • 38.
  • 40. ➡ Not the same as session scope ➡ A transitionary space + Caching Layer ➡ entityLoad() ➡ entityNew() ? ➡ You need to control when to send to DB ➡ transaction{}, ormflush() ➡ You can remove entities from it and clear it ➡ ORMClearSession() ➡ ORMEvictEntity(), ORMEvictCollection() ➡ ORMCloseSession() UNDERSTAND THE HIBERNATE SESSION
  • 41. Hibernate Session (Conversation - Request) DB Eu Ex Ez Ey Cache ehCache/ Couchbase Batched SQL EntityNew() EntityLoad() Data (!CFCs) Hibernate Session Factory (application) CRUD When? ORMClearSession() UNDERSTAND THE HIBERNATE SESSION
  • 42. DB Sync Insertions in order updates Collectiondeletions collectiondeletion,updates, inserts collectioninsertions deletions in order UNDERSTAND THE HIBERNATE SESSION
  • 43. ➡ 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 raw transactions TRANSACTION DEMARCATION
  • 44. ➡ Transaction Theory: ➡ Any existing ORM session is flushed and reused ➡ Data can be committed or rollback ➡ ORMFlush() is ignored in transactions ➡ If commit, then flushed to database ➡ If rollback, session is cleared TRANSACTION DEMARCATION
  • 47. ➡ Don’t do it! ➡ Breaks the link to the Hibernate Session ➡ Relationships will fail if not lazy loaded ➡ entityMerge() ➡ Store ID’s or data instead, then inflate the entities AVOID SCOPING ENTITIES
  • 48. ➡ #1 Performance Problem ➡ Identify relationships ➡ Identify HQL, SQL ➡ Create indexes! DATABASE INDEXES
  • 49. ➡ Don’t go cache crazy, develop a strategy ➡ Misconception: Does not store CFC ➡ Stores individual property values ➡ Use distributed caches: ehcache, couchbase, redis ➡ 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() CACHE BOOSTING
  • 52. ➡ The fastest gun in the galaxy! ➡ Return array of structs ➡ Why a full ORM Object graph? ➡ Boost your APIs, stop converting queries/ array of objects to JSON HQL MAPS
  • 54.
  • 55. When is HappyBox? ORM was fast Extensible way to finish the remaining 20% CF ORM was easier to use? 80% of API Querying OO way to query Auto build relationships ORM THOUGHTS?
  • 56. Base ORM Service Virtual ORM Service Active Entity Entity Populators Validation Event Handlers DI/AOP OVERVIEW
  • 57. ➡ Service layer for any entity ➡ OO Querying, caching, transactions ➡ Dynamic finders, getters, counters ➡ Object metadata & session management ➡ Exposes more features from Hibernate ➡ 90% Foundation BASE ORM SERVICE
  • 58. ➡ Extends Base ORM Services ➡ Roots itself to a single entity = Less Typing ➡ You can build the 10% VIRTUAL SERVICES
  • 59. ➡ Active Record Pattern ➡ Sweet validation integration ➡ DI/AOP Available ACTIVE ENTITY
  • 60. ➡ 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
  • 62. ➡ 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
  • 63. BASE ORM SERVICE Dynamic Finders/Counters ➡ Expressive Programming ➡ Three types of dynamic Finders/Counters ➡ fi ndBy : fi nd ONE entity ➡ fi ndAllBy : fi nd ALL entities ➡ countBy: Give you a count
  • 64. BASE ORM SERVICE Dynamic Finders/Counters ➡ 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
  • 66. 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!
  • 67. 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
  • 69. 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()
  • 70. CRITERIA BUILDER ➡ between() ➡ eq() ➡ gt() ➡ ge() ➡ gtProperty() ➡ isEmpty() ➡ isNull() ➡ ne() ➡ ilike() ➡ and() ➡ or() ➡ not() ➡ conjunction() ➡ disjunction() ➡ isTrue() ➡ isFalse() ➡ sqlRestriction() ➡ ...much more! RESTRICTIONS
  • 71. CRITERIA BUILDER RETRIEVALS ➡ Retrieval ➡ firstResult() ➡ get() ➡ list() ➡ count() ➡ Options ➡ fetchSize() ➡ readOnly() ➡ maxResults() ➡ cache(), cacheRegion() ➡ timeout() ➡ order()
  • 72. 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!
  • 73. 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
  • 74. CRITERIA BUILDER DEBUGGING + LOGGING ➡ Criteria Builder SQL Inspector ➡ startSQLLog( returnExecutableSQL, formatSQL ) ➡ stopSQLLog() ➡ getSQLLog() ➡ getSQL( returnExecutableSQL, formatSQL )