User Guide Cancel

ORM architecture

  1. ColdFusion Developers Guide
  2. Develop ColdFusion applications
    1. Introducing ColdFusion
      1. Introducing ColdFusion
      2. About ColdFusion
      3. About Internet applications and web application servers
      4. About JEE and the ColdFusion architecture
    2. Changes in ColdFusion
      1. Changes in ColdFusion
      2. Replacement of JRun with Tomcat
      3. Security enhancements
      4. ColdFusion WebSocket
      5. Enhanced Java integration
      6. ColdFusion ORM search for indexing and search
      7. Solr enhancements
      8. Scheduler enhancements
      9. Integration with Microsoft Exchange Server 2010
      10. RESTful Web Services in ColdFusion
      11. Lazy loading across client and server in ColdFusion
      12. Web service enhancements
      13. Displaying geolocation
      14. Client-side charting
      15. Caching enhancements
      16. Server update using ColdFusion Administrator
      17. Secure Profile for ColdFusion Administrator
    3. Introduction to application development
      1. Introduction to application development using ColdFusion
      2. Using the Developing ColdFusion Applications guide
      3. About Adobe ColdFusion documentation for Developers
    4. The CFML programming language
      1. The CFML programming language
      2. Elements of CFML
      3. ColdFusion variables
      4. Expressions and number signs
      5. Arrays and structures
      6. Extend ColdFusion pages with CFML scripting
      7. Regular expressions in functions
      8. ColdFusion language enhancements
      9. Built-in functions as first class citizen
      10. Data types- Developing guide
    5. Building blocks of ColdFusion applications
      1. Building blocks of ColdFusion applications
      2. Create ColdFusion elements
      3. Write and call user-defined functions
      4. Build and use ColdFusion Components
      5. Create and use custom CFML tags
      6. Build custom CFXAPI tags
      7. Use the member functions
      8. Object Oriented Programming in ColdFusion
    6. Develop CFML applications
      1. Develop CFML applications
      2. Design and optimize a ColdFusion application
      3. Handle errors
      4. Use persistent data and locking
      5. Use ColdFusion threads
      6. Secure applications
      7. Client-side CFML (for mobile development)
      8. Use the ColdFusion debugger
      9. Debugging and Troubleshooting Applications
      10. Develop globalized applications
      11. REST enhancements in ColdFusion
      12. Authentication through OAuth
      13. Social enhancements
    7. Develop mobile applications
      1. Mobile application development
      2. Build mobile applications
      3. Debug mobile applications
      4. Inspect mobile applications
      5. Package mobile applications
      6. Troubleshoot mobile applications
      7. Device detection
      8. Client-side CFML
      9. Mobile Templates
      10. Code samples to build a mobile application
    8. Access and use data
      1. Access and use data
      2. Introduction to Databases and SQL
      3. Access and retrieve data
      4. Update database
      5. Use Query of Queries
      6. Manage LDAP directories
      7. Solr search support
    9. ColdFusion ORM
      1. ColdFusion ORM
      2. Introducing ColdFusion ORM
      3. ORM architecture
      4. Configure ORM
      5. Define ORM mapping
      6. Work with objects
      7. ORM session management
      8. Transaction and concurrency
      9. Use HQL queries
      10. Autogenerate database schema
      11. Support for multiple data sources for ORM
      12. ColdFusion ORM search
    10. ColdFusion and HTML5
      1. ColdFusion and HTML 5
      2. Use ColdFusion Web Sockets
      3. Media Player enhancements
      4. Client-side charting
      5. Display geolocation data
    11. Flex and AIR integration in ColdFusion
      1. Flex and AIR integration in ColdFusion
      2. Use the Flash Remoting Service
      3. Use Flash Remoting Update
      4. Offline AIR application support
      5. Proxy ActionScript classes for ColdFusion services
      6. Use LiveCycle Data Services ES assembler
      7. Use server-side ActionScript
    12. Request and present information
      1. Request and present information
      2. Retrieve and format data
      3. Build dynamic forms with cfform tags
      4. Validate data
      5. Create forms in Flash
      6. Create skinnable XML forms
      7. Use Ajax data and development features
      8. Use Ajax User Interface components and features
    13. Office file interoperability
      1. Office file interoperability
      2. Using cfdocument
      3. Using cfpresentation
      4. Using cfspreadsheet
      5. Supported Office conversion formats
      6. SharePoint integration
    14. ColdFusion portlets
      1. ColdFusion portlets
      2. Run a ColdFusion portlet on a JBoss portal server
      3. Run a ColdFusion portlet on a WebSphere portal server
      4. Common methods used in portlet.cfc
      5. ColdFusion portlet components
      6. Support for JSR-286
    15. Work with documents, charts, and reports
      1. Work with documents, charts, and reports
      2. Manipulate PDF forms in ColdFusion
      3. Assemble PDF documents
      4. Create and manipulate ColdFusion images
      5. Create charts and graphs
        1. About charts
        2. Creating a basic chart
        3. Charting data
        4. Controlling chart appearance
        5. Creating charts: examples
        6. Administering charts
        7. Writing a chart to a variable
        8. Linking charts to URLs
        9. Charting enhancements
      6. Create reports and documents for printing
      7. Create reports with Report Builder
        1. About Report Builder
        2. Common reporting tasks and techniques
        3. Creating a simple report
        4. Getting started
      8. Create slide presentations
    16. Use web elements and external objects
      1. Use web elements and external objects
      2. Use XML and WDDX
      3. Use web services
      4. Use ColdFusion web services
      5. Integrate JEE and Java elements in CFML applications
      6. Use Microsoft .NET assemblies
      7. Integrate COM and CORBA objects in CFML applications
    17. Use external resources
      1. Send and receive e-mail
      2. Interact with Microsoft Exchange servers
      3. Interact with remote servers
      4. Manage files on the server
      5. Use event gateways
      6. Create custom event gateways
      7. Use the ColdFusion extensions for Eclipse
      8. Use the data services messaging event gateway
      9. Use the data management event gateway
      10. Use the FMS event gateway
      11. Use the instant messaging event gateways
      12. Use the SMS event gateway

In ColdFusion ORM, you need to define an object mapping to create persistent objects. The object mapping includes details such as:

  • The table name for the object's class
  • The column name that corresponds to each field in the object
  • The join conditions for related objects

ColdFusion allows you to specify the mapping in CFCs. Such CFCs are called as persistent CFCs. Each persistent CFC usually maps to a table in the database. Each property in the CFC usually maps to a column in the table. Additional properties may be used to define relationships and other mapping details. 
When ColdFusion creates the Hibernate configuration for the application, these persistent CFCs are used to automatically generate Hibernate mapping files, which have the extension ".hbmxml". For example, if ARTISTS.cfc is a persistent CFC, ColdFusion would automatically generate Artists.hbmxml. Hibernate mapping files contain the mapping information in XML format that Hibernate defines, to work with ColdFusion ORM. These Hibernate mapping files can be created manually. 
For more information about creating Hibernate mappings manually, see Advanced mapping.
To use ColdFusion ORM, ColdFusion application must have ormenabled set to true in the THIS scope of Application.cfc. To define a persistent CFC, set persistent="true" in cfcomponent tag. An array of attributes are available in cfcomponent and cfproperty to specify mapping information. 
For details, see Define ORM mapping.
When the application starts, ColdFusion first loads the Hibernate configuration file if it is specified in the application. The Hibernate configuration file contains various configuration parameters like including, dialect, cache settings, and mapping files that are required for the application. If a configuration file is not specified, ColdFusion ORM creates the Hibernate configuration using the default settings.
After loading the Hibernate configuration, all the mapping files (*.hbmxml) in the application folder and its mapped folders are loaded and added to the configuration.
ColdFusion then searches for persistent CFCs in the application folder and its mapped folders. If the hibernate mapping file is not present for any persistent CFC, ColdFusion generates it. If mapping information, such as primary key, foreign key, and column data type is missing in the persistent CFCs, ColdFusion automatically inspects the database and identifies the mapping. 
ColdFusion then checks if DDL needs to be generated. This can be configured using the dbcreate option in the ORM settings. Based on the configuration option specified in dbcreate, tables are created or updated.The Hibernate SessionFactory is then built and made available to the application as long as the application is running. The SessionFactory is used to create Hibernate sessions that manage the persistent object lifecycle. 
In ColdFusion, a Hibernate session starts when the first CRUD method is called and ends when the request ends or when the ORMCloseSession() method is called. 
To improve performance, Hibernate batches all the Create/Update/Delete operations in the session and runs them when the session is flushed or only when necessary. Session Flush happens when the request ends or when the ORMFlush() method is called. 
For transactions, a new session is always created at the start of a transaction and ends at the end of a transaction. Any previous open sessions are flushed and closed at the start of the transaction. 
The Hibernate configuration is created and loaded only when the application starts. Therefore, any modifications to the mapping in the persistent CFCs or in the Hibernate mapping files are not loaded automatically. To load these modifications, you can either restart the application or call ORMReload(). 
To restart the application, you can stop the application using ApplicationStop() and the next request to any page in this application automatically starts it.

 Adobe

Get help faster and easier

New user?