This intermediate to advanced session will show how to save development time in creating ColdFusion applications by leveraging ORM to achieve data persistency. Briefly going over the setup and CRUD functions we will concentrate on advanced ORM features that enable you to write less of better code.
Framework One has been the choice of many developers for the past several years. Whether you are still on the crossroads of framework dilemma or have been working with FW/1 before, this presentation will show some of the new and advanced features of this framework: subsystems, REST support, skinning, multi-site setup as well as DI/1, AOP/1 and others. Targeting intermediate level of developers this presentation will show ideas for the use of the framework as well as demonstrate commonly used functions.
Presentation for azPHP on setting up a new project using Zend_Tool. Also goes over creating basic modules, controllers, actions, models and layouts.
All code in the presentation has not necessarily been tested. Will update presentation when done.
Introducing Assetic: Asset Management for PHP 5.3Kris Wallsmith
The performance of your application depends heavily on the number and size of assets on each page. Even your blazingly fastest Symfony2 application can be bogged down by bloated Javascript and CSS files. This session will give you a basic introduction to PHP's new asset management framework, Assetic, and explore how it integrates with Symfony2 for a pleasant, common sense developer experience.
Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
Framework One has been the choice of many developers for the past several years. Whether you are still on the crossroads of framework dilemma or have been working with FW/1 before, this presentation will show some of the new and advanced features of this framework: subsystems, REST support, skinning, multi-site setup as well as DI/1, AOP/1 and others. Targeting intermediate level of developers this presentation will show ideas for the use of the framework as well as demonstrate commonly used functions.
Presentation for azPHP on setting up a new project using Zend_Tool. Also goes over creating basic modules, controllers, actions, models and layouts.
All code in the presentation has not necessarily been tested. Will update presentation when done.
Introducing Assetic: Asset Management for PHP 5.3Kris Wallsmith
The performance of your application depends heavily on the number and size of assets on each page. Even your blazingly fastest Symfony2 application can be bogged down by bloated Javascript and CSS files. This session will give you a basic introduction to PHP's new asset management framework, Assetic, and explore how it integrates with Symfony2 for a pleasant, common sense developer experience.
Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
What do you know about Page Object Pattern? Simon Stewart who first applied it in 2009 using the Selenium WebDriver. Next appear a helpful wrapper for Page Object, such as Page Element, ScreenPlay, LoadabLe Component and etc. If you are interested to see how the interface changed the presentation of the Page Object, look at this presentation
You Don't Know Query (WordCamp Netherlands 2012)andrewnacin
An update to a talk I gave at WordCamp Portland 2011, "You Don't Know Query" is an advanced development talk from March 25, 2012, in Utrecht, Netherlands.
Got data? Let's make it searchable! This interactive presentation will demonstrate getting documents into Solr quickly, provide some tips in adjusting Solr's schema to match your needs better, and finally showcase your data in a flexible search user interface. We'll see how to rapidly leverage faceting, highlighting, spell checking, and debugging. Even after all that, there will be enough time left to outline the next steps in developing your search application and taking it to production.
Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
Concise and elegant automated tests?
Pain free ( almost ) web UI test stack?
More time for drinking coffee/playing Cuphead/starring into the void* ?
Jump in, we’ll talk Lombok, Vavr, Owner, why you should use ready solutions and how to make tests more concise and readable. Vaper and/or hoverboard required.
Drupal 8 Services And Dependency InjectionPhilip Norton
Using the service manager is an essential part of a Drupal 8 developers toolkit and understanding it not only helps development, but can also allow you to create modules that can be easily used by other developers. There are numerous code examples out there that talk about using this or that service, so I'll look at how to go from "\Drupal::service('thing');" to finding and using services within Drupal 8. I will look at creating custom services to use within your own modules and provide injectable dependencies for other modules. I will also show how to override services to provide your own functionality to existing services. All code shown will be real examples that you can take away and use in your own projects.
Given at DrupalCamp London 2018
Understanding configuration in Drupal 8 is essential. It's a powerful tool that can streamline your development and deployment processes. After several rescue projects over the past year I have realised that the one thing that goes wrong first is the configuration. For some reason it's always left until last or even as an afterthought and this can really de-rail projects.
In this session I will cover.
How to get your configuration in and out of Drupal.
How to best manage your configuration.
Using configuration modules like Configuration Ignore and Configuration Split to manage your configuration across different platforms.
What to do when the client changes the configuration on your site and some other common problems that you might encounter.
Note: This presentation contained some videos that I couldn't translate into slideshare.
Go beyond the documentation and explore some of what's possible if you stretch symfony to its limits. We will look at a number of aspects of symfony 1.4 and Doctrine 1.2 and tease out some powerful functionality you may not have expected to find, but will doubtless be able to use. Topics covered will include routing, forms, the config cache and record listeners. If you're comfortable in symfony and wondering what's next, this session is for you.
OSCON Google App Engine Codelab - July 2010ikailan
Slides for the App Engine codelab given on July 20, 2010. Note that a more verbose version of this codelab is available at:
https://sites.google.com/site/gdevelopercodelabs/app-engine/python-codelab
Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
What do you know about Page Object Pattern? Simon Stewart who first applied it in 2009 using the Selenium WebDriver. Next appear a helpful wrapper for Page Object, such as Page Element, ScreenPlay, LoadabLe Component and etc. If you are interested to see how the interface changed the presentation of the Page Object, look at this presentation
You Don't Know Query (WordCamp Netherlands 2012)andrewnacin
An update to a talk I gave at WordCamp Portland 2011, "You Don't Know Query" is an advanced development talk from March 25, 2012, in Utrecht, Netherlands.
Got data? Let's make it searchable! This interactive presentation will demonstrate getting documents into Solr quickly, provide some tips in adjusting Solr's schema to match your needs better, and finally showcase your data in a flexible search user interface. We'll see how to rapidly leverage faceting, highlighting, spell checking, and debugging. Even after all that, there will be enough time left to outline the next steps in developing your search application and taking it to production.
Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
Concise and elegant automated tests?
Pain free ( almost ) web UI test stack?
More time for drinking coffee/playing Cuphead/starring into the void* ?
Jump in, we’ll talk Lombok, Vavr, Owner, why you should use ready solutions and how to make tests more concise and readable. Vaper and/or hoverboard required.
Drupal 8 Services And Dependency InjectionPhilip Norton
Using the service manager is an essential part of a Drupal 8 developers toolkit and understanding it not only helps development, but can also allow you to create modules that can be easily used by other developers. There are numerous code examples out there that talk about using this or that service, so I'll look at how to go from "\Drupal::service('thing');" to finding and using services within Drupal 8. I will look at creating custom services to use within your own modules and provide injectable dependencies for other modules. I will also show how to override services to provide your own functionality to existing services. All code shown will be real examples that you can take away and use in your own projects.
Given at DrupalCamp London 2018
Understanding configuration in Drupal 8 is essential. It's a powerful tool that can streamline your development and deployment processes. After several rescue projects over the past year I have realised that the one thing that goes wrong first is the configuration. For some reason it's always left until last or even as an afterthought and this can really de-rail projects.
In this session I will cover.
How to get your configuration in and out of Drupal.
How to best manage your configuration.
Using configuration modules like Configuration Ignore and Configuration Split to manage your configuration across different platforms.
What to do when the client changes the configuration on your site and some other common problems that you might encounter.
Note: This presentation contained some videos that I couldn't translate into slideshare.
Go beyond the documentation and explore some of what's possible if you stretch symfony to its limits. We will look at a number of aspects of symfony 1.4 and Doctrine 1.2 and tease out some powerful functionality you may not have expected to find, but will doubtless be able to use. Topics covered will include routing, forms, the config cache and record listeners. If you're comfortable in symfony and wondering what's next, this session is for you.
OSCON Google App Engine Codelab - July 2010ikailan
Slides for the App Engine codelab given on July 20, 2010. Note that a more verbose version of this codelab is available at:
https://sites.google.com/site/gdevelopercodelabs/app-engine/python-codelab
This DrupalCon 2019 Amsterdam talk provides a look beyond the world of PHP and Javascript. It explores how other languages such as Ruby, Java, Rust and Perl handle things and highlights some interesting features of those languages. Not all the things that other languages can do can be done in PHP or Javascript but the concepts and ideas can still be used.
Drupal 8, Where Did the Code Go? From Info Hook to PluginAcquia
Looking at core and contrib modules for Drupal 8, you may be wondering "where did the code go?". Drupal 8 has removed many of the "info" hooks that were found in your module file and converted them to plugins.
In this webinar, we’ll discuss how plugins work and how to upgrade your module to Drupal 8 if it used one of the hooks that's been converted to a plugin.
Topics covered will include:
-Essentials of implementing your own plugin if your module previously used an “info” hook
-An explanation of plugin terminology and different ways plugins can be discovered
-Examples of code from Drupal 7 and where the very similar code lives in Drupal 8
-How to avoid implementing hooks by mistake when writing a function in your modules
Come to this talk prepared to learn about the Doctrine PHP open source project. The Doctrine project has been around for over a decade and has evolved from database abstraction software that dates back to the PEAR days. The packages provided by the Doctrine project have been downloaded almost 500 million times from packagist. In this talk we will take you through how to get started with Doctrine and how to take advantage of some of the more advanced features.
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Google App Engine in 40 minutes (the absolute essentials)Python Ireland
This talk covers just the stuff needed to get you up-to-speed with Google App Engine and its associated technologies (based on the Python run-time, of course). In addition to a bit of talking, Paul will also demo a working webapp built and deployed on the App Engine cloud... all in 40 minutes.
Ingesting and Manipulating Data with JavaScriptLucidworks
Data in the wild isn’t always in the right format we need for search or even mere usability. Lucidworks Fusion offers powerful pipelines, parsers, and stages to wrangle your data into the right format to make it more findable and friendly. However, there are some cases where more obscure data will require the power of scripting.
Your data may need a complex transformation, a custom decryption algorithm, or you may already have existing code for handling a piece of data. Even in these more complex cases, Fusion’s JavaScript capabilities have got you covered.
MongoDB is the trusted document store we turn to when we have tough data store problems to solve. For this talk we are going to go a little bit off the path and explore what other roles we can fit MongoDB into. Others have discussed how to turn MongoDB’s capped collections into a publish/subscribe server. We stretch that a little further and turn MongoDB into a full fledged broker with both publish/subscribe and queue semantics, and a the ability to mix them. We will provide code and a running demo of the queue producers and consumers. Next we will turn to coordination services: We will explore the fundamental features and show how to implement them using MongoDB as the storage engine. Again we will show the code and demo the coordination of multiple applications.
A talk about the current state of java enterprise development, evaluation of the available alternatives to conventional enterprise solutions, tools and languages for the JVM, and possibly beyond.
JUG-Roma meeting 16 Sept 2014
Similar to Let ColdFusion ORM do the work for you! (20)
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIVladimir Iglovikov, Ph.D.
Presented by Vladimir Iglovikov:
- https://www.linkedin.com/in/iglovikov/
- https://x.com/viglovikov
- https://www.instagram.com/ternaus/
This presentation delves into the journey of Albumentations.ai, a highly successful open-source library for data augmentation.
Created out of a necessity for superior performance in Kaggle competitions, Albumentations has grown to become a widely used tool among data scientists and machine learning practitioners.
This case study covers various aspects, including:
People: The contributors and community that have supported Albumentations.
Metrics: The success indicators such as downloads, daily active users, GitHub stars, and financial contributions.
Challenges: The hurdles in monetizing open-source projects and measuring user engagement.
Development Practices: Best practices for creating, maintaining, and scaling open-source libraries, including code hygiene, CI/CD, and fast iteration.
Community Building: Strategies for making adoption easy, iterating quickly, and fostering a vibrant, engaged community.
Marketing: Both online and offline marketing tactics, focusing on real, impactful interactions and collaborations.
Mental Health: Maintaining balance and not feeling pressured by user demands.
Key insights include the importance of automation, making the adoption process seamless, and leveraging offline interactions for marketing. The presentation also emphasizes the need for continuous small improvements and building a friendly, inclusive community that contributes to the project's growth.
Vladimir Iglovikov brings his extensive experience as a Kaggle Grandmaster, ex-Staff ML Engineer at Lyft, sharing valuable lessons and practical advice for anyone looking to enhance the adoption of their open-source projects.
Explore more about Albumentations and join the community at:
GitHub: https://github.com/albumentations-team/albumentations
Website: https://albumentations.ai/
LinkedIn: https://www.linkedin.com/company/100504475
Twitter: https://x.com/albumentations
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
1. Let ColdFusion ORM doLet ColdFusion ORM do
the work for you!the work for you!
CFSummit 2018CFSummit 2018
Presenter: Masha EdelenPresenter: Masha Edelen
2. Who am I?Who am I?
Full Stack Web Developer of 16+ years
HD Web Studio Owner and Visionary
Mother to a Teenage Daughter
Travel Enthusiast
Live Music Fan
Amateur Latin Dancer
5. What is ORM?What is ORM?
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSD628ADC4-A5F7-4079-99E0-FD725BE9B4BD.html
Object relational mapping (ORM) is a programming
framework that allows you to define a mapping between
application object model and the relational database.
7. Why should I use an ORM?Why should I use an ORM?
Reduces development time
Overcomes vendor specific SQL differences
Promotes effective design patterns
Reduces maintenance
9. Getting StartedGetting Started
Step 1: Configuring ORM in your Application
Application.cfc
component {
// set the unique name of the application
this.name = "myCMS";
// set the datasource
this.datasource = "mydsn";
// turn ORM on
this.ormenabled = true;
}
10. Step 2: Mapping Tables to Objects
Article.cfc
/*** I model a blog article ***/
component persistent="true" table="articles" {
// identifier
property name="id" fieldtype="id" generator="native" column="articleI
// properties
property name="title" ormType="string" length="250";
property name="summary" ormType="string" length="500";
property name="description" ormType="text";
}
16. ReadRead
UpdateUpdate
DeleteDelete
// Get all categories
categories = EntityLoad("Category");
WriteDump(var = categories, top = 2);
// Get category and update its title
myCategory = EntityLoadByPK("Category", 1);
myCategory.setTitle("New Title");
// Delete category
myCategory = EntityLoadByPK("Category", 1);
EntityDelete(myCategory);
17. More ExamplesMore Examples
// Get all categories set to display
categories = EntityLoad("Category", {dsp = true});
// Get all categories set to display and ordered chronologically
categories = EntityLoad("Category", {dsp = true}, "date desc");
18. More ExamplesMore Examples
// Get category by ID
myCategory = EntityLoadbyPK("Category",1);
// Get category by ID
myCategory = EntityLoad("Category",1);
myCategory = EntityLoad("Category",1,true);
19. Convert Object to QueryConvert Object to Query
// Convert object to query
myCategory = EntityLoadbyPK("Category",1);
myCategoryQuery = EntityToQuery(myCategory);
// Convert array of objects to query
categories = EntityLoad("Category");
categoriesQuery = EntityToQuery(categories);
24. One-to-Many UsageOne-to-Many Usage
// Create a new article and add to an existing author
transaction {
// load the author
author = EntityLoadByPK("author", 1);
// create an article
article = EntityNew("article");
article.setTitle("ORM Makes My Life Easy!");
// attach the article to the author
author.addArticle(article);
// save the article
EntitySave(article);
};
writeDump(author.getArticles(), top="2");
25. Many-to-OneMany-to-One
Article.cfc
/*** I model an article ***/
component persistent="true" table="articles" {
// identifier
property name="id" fieldtype="id" generator="native";
...
//many Article entities can have one Author entity
property name="Author" fieldtype="many-to-one"
cfc="Author" fkcolumn="fk_authorid";
}
27. Many-to-ManyMany-to-Many
Category.cfc
/*** I model a category ***/
component persistent="true" table="categories" {
//identifier
property name="id" fieldtype="id" generator="native";
...
//category can be assigned to more than one article
property name="articles" fieldtype="many-to-many"
cfc="Articles" type="array" singularname="article"
linktable="articles_categories";
}
29. OO Modeling is Key!OO Modeling is Key!
ORM Persistence Model is a set of ORM Entities
related based on business logic of the application.
Objects vs Tables
Persistence Model vs Database Schemas
Data + Behavior vs Data
30. The Inverse AttributeThe Inverse Attribute
Author.cfc
/*** I model an author ***/
component persistent="true" table="authors" {
...
// one author can have many articles
property name="articles" fieldtype="one-to-many"
cfc="Article" fkcolumn="fk_authorid" type="array"
singularname="article"
// added attributes
inverse="true" cascade="delete";
}
32. Sort OrderSort Order
Author.cfc
/*** I model an author ***/
component persistent="true" table="authors" {
...
// one author can have many articles
property name="articles" fieldtype="one-to-many"
cfc="Article" fkcolumn="fk_authorid" type="array"
singularname="article"
inverse="true" cascade="delete"
// added sorting
orderby="datepublished desc";
}
33. Where FilterWhere Filter
Author.cfc
/*** I model an author ***/
component persistent="true" table="authors" {
...
// getting only published articles
property name="publishedArticles" fieldtype="one-to-many"
cfc="Article" fkcolumn="fk_authorid"
orderby="datepublished desc"
// filter
where="ispublished = 1";
}
34. FormulasFormulas
Author.cfc
/*** I model an author ***/
component persistent="true" table="authors" {
...
// get count of active articles
property name="publishedArticleCount" setter="false"
formula="select count(*)
from Articles a
where author_pk = a.fk_authorid
and a.ispublished = 1";
}
36. HQLHQL
Same as:
// get users
EntityLoad("User");
// get users with HQL
ORMExecuteQuery("from User");
37. SQL Injection PreventionSQL Injection Prevention
Same as:
Better:
Or:
// get user by ID
userid = 123;
EntityLoadByPK("User", id);
// get user by ID with HQL
ORMExecuteQuery("from User where id = #userid#", true);
// get user by ID with HQL using positional parameters
ORMExecuteQuery("from User where id = ?", [userid], true);
// get user by ID with HQL using named parameters
ORMExecuteQuery("from User where id = :id", {id=userid}, true);
38. HQL ExamplesHQL Examples
ORMExecuteQuery(hql, params [,unique] [,queryOptions])
// get users with usernames that start with letter J
q = ORMExecuteQuery(
"from user where username like :prefix", {prefix = "J%"}
);
// get art pieces priced over $400
q = ORMExecuteQuery(
"from art where price > :lowprice", {lowprice = 400}
);
// adding queryOptions
q = ORMExecuteQuery(
"from artist", false, {offset=5, maxresults=10, timeout=5}
);
39. Relationships HQLRelationships HQL
Get articles by Author ID:
The HQL way:
// load author
author = EntityLoadByPK("Author", 2);
// get this author's articles
articles = author.getArticles();
from article
where author.id = :authorID
40. Relationships HQLRelationships HQL
Get published articles by Author ID:
Get unique authors:
from article
where
author.id = :authorID
and
ispublished = :isPublished
select distinct a.author
from article a
where
a.ispublished = :isPublished
43. ErrorsErrors
Error during DDL export
Cannot simultaneously fetch multiple bags
Failed to lazily initialize a collection of role, no session or
session was closed
Illegal attempt to dereference collection
46. Hibernate Session ManagementHibernate Session Management
ORM session starts when the first CRUD method is called
and is closed when the request ends.
// manage session manually
this.ormsettings = {
...
//switch to false and use transactions
autoManageSession = false,
flushAtRequestEnd = false
}
51. Batch FetchingBatch Fetching
At CFC level
At collections
// implement batching
component table="artist" batchsize="10"...
...
// get artist as usual
getArtist();
// implement batching for related entity
property name="art" fieldtype="one-to-many" cfc="art" fkcolumn="artistID" bat
...
// get all the art of a specific artist
artist.getArt();
56. Caching HQLCaching HQL
// implement caching for HQL query
e = ORMExecuteQuery(
"from article where id = :id",
{id=1},
{cacheable=true, cachename='articles'}
);
57. Managing the CacheManaging the Cache
// clear cache for author
ORMEvictEntity( "author" );
ORMEvictEntity( "author", 1 );
// clear cache for articles
ORMEvictCollection( "author", "articles" );
ORMEvictCollection( "author", "articles", 1 );
// clear cache for HQL
ORMEvictQueries( "mycachename" );
ORMEvictQueries();
58. Advanced Use CasesAdvanced Use Cases
Query: Retrieve distinct countries of all addresses in alphabetical order.
SQL:
HQL:
Criteria API:
select distinct country from address ordered by country
select distinct country from address ordered by country
criteria.setProjection(projections.distinct(projections.property("Country")))
criteria.addOrder(order.asc("locality"));
59. ColdBox ORM ModuleColdBox ORM Module
https://www.forgebox.io/view/cborm
"This module provides you with several enhancements
when interacting with the ColdFusion ORM via Hibernate.
It provides you with virtual service layers, active record
patterns, criteria and detached criteria queries, entity
compositions, populations and so much more to make your
ORM life easier!
In other words, it makes using ORM not SUCK!"
60. There is more!There is more!
Convenience Methods
Versioning
Validation
ORM Search
Advanced Mapping
Event Handlers (Interceptors)
61. Online ResourcesOnline Resources
Developing Applications Adobe ColdFusion ORM
ColdFusion ORM Developer Guide
CF-ORM Google Group
Hibernate Documentation
ORM Slack Channel on CFML Slack Team
https://helpx.adobe.com/coldfusion/developing-applications/user-guide.html?topic=/coldfusion/developing-applications/morehelp/coldfusion-orm.ug.js
http://adobe.ly/LnJilm
http://groups.google.ca/group/cf-orm-dev
http://www.hibernate.org/docs
62. PublicationsPublications
Java Persistence with Hibernate
Adobe ColdFusion 9 Web Application Construction Kit, Volume 2:
Application Development
ColdFusion ORM
http://www.manning.com/bauer2/
http://forta.com/books/0321679199/
http://www.coldfusionormbook.com
63. Please submit your surveyPlease submit your survey
for a chance to win!for a chance to win!
Go to the ColdFusion Summit mobile app
Find this session: D103: Let ColdFusion ORM do the work for you!
Make sure you have registered for this session
Select the “Survey” link at the bottom of the session and complete the
survey
Each survey has a chance to win $25 Amazon Gift Certificate