ILOG JRules User Guide > Integrating Application Data > Concepts > Third Party Data Access

ILOG JRules can be integrated with most data access patterns with little or no additional infrastructure code. This section describes a number of DAO (Data Access Objects) products and approaches, and provides an example of one of these: JDO.

Based on architectural decisions, data access must be customized for use with ILOG JRules. For a simple scenario, customization may include:

DAO Products

There are a number of commercial or Open Source persistence frameworks for Java. The following tables provide a brief overview of some of these tools. The tools are split into enabling technologies and Integrated Development Environments (IDEs).

Table 2 DAO Products: Enabling Technologies
Enabling Technologies 
Description 
More Information 
Java Data Objects (JDO) 
A generic data persistence API for Java. It enables interface-based definitions of data stores and transactions, and the selection and transformation of persistent storage data into native Java programming language objects. 
Spring Framework 
A J2EE framework. It provides a framework for data access, whether using JDBC or an Object/Relational (O/R) mapping product such as TopLink, Hibernate or a JDO implementation. 
Hibernate 
A tool for binding data. Hibernate is an O/R persistence and query service for Java. It lets you develop persistent objects following common Java idioms, including association, inheritance, polymorphism, composition and the Java collections framework. The Hibernate Query Language, designed as a minimal object-oriented extension to SQL, provides a bridge between the object and relational worlds.  
EJB 3.0 and JPA 
A framework for accessing data. A Java Persistence API (JPA) is provided with Enterprise Jave Beans (EJB) 3.0 to access databases. EJB enables the development and deployment of component-based business applications. Applications written using EJB are scalable, transactional, and multi-user secure. These applications may be written once, then deployed on any server platform that supports the EJB specification. 
Xcalia LiDO 
An enterprise solution to access data in large transactional Java applications. It is provided as an implementation of JDO. It provides an internal cache and optimization features to avoid costly dynamic runtime generation. It also supports optimization of already deployed applications. 
OracleAS TopLink 
An object-persistence and object-transformation framework. It provides the reference implementation of JPA. It provides development tools and runtime capabilities that are designed to reduce development and maintenance effort. 
Oracle Application Development Framework's Data Binding Layer 
An enabling technology that provides consistent, declarative data binding against multiple back-end technologies. It accommodates business services implemented as Application Development Framework (ADF) Application Modules, custom JavaBeans, EJBs, and Web services. 
Service Data Objects (JSR-235) 
AJSR a standard to access data in J2EE. Service Data Objects (SDO) defines core infrastructure APIs for heterogeneous data access that supports common application design patterns, and supports higher-level tools and frameworks. It is currently under review by the Java Community Process (JCP) as JSR-235. SDO is similar to Microsoft ADO in that it defines a generic data binding, query and metadata layer for various services, including RDBMS and XML.  
BEA Liquid Data for WebLogic 
A data access and aggregation product. It provides information visibility through real-time data aggregation across data sources such as relational databases, XML files, Web services, and packaged and custom applications. It enables developers to access and share business entities without having to deal with the complexities of different data structures, relationships or semantics. Liquid Data for WebLogic builds on existing IT infrastructure and uses XML standards and BEA WebLogic Server to provide an enterprise-wide data aggregation solution. 

Table 3 DAO Products: Integrated Development Environments
IDEs 
Description 
More Information 
Rational Application Developer for WebSphere Software 
An IDE that enables you to design, develop, analyze, test, profile and deploy Java/J2EE, Portal, Web, Web services and SOA applications. 
Eclipse Web Tools 
A tool that provides APIs for J2EE and Web-centric application development. It includes both source and graphical editors for a variety of languages, wizards and built-in applications to simplify Web Service development, and tools and APIs to support deploying, running, and testing applications. 
http://www.eclipse.org/webtools/main.php 
BEA WebLogic Workshop 
A J2EE development IDE. It is designed to make J2EE accessible to any developer--not just J2EE experts. Workshop lets you visually build and assemble enterprise-scale Web services, Web applications, JSPs, Portals, EJBs, and business process models that are optimized for the WebLogic Platform, but deployable to any. 
ILOG provides a custom JRules control that allows you to integrate business rules in BEA WebLogic Workshop without coding.  

 

 

 
IBM Rational Software Architect 
An advanced model-driven development tool. It enables model-driven development with UML for creating well-architected applications and services. IBM Rational Software Architect extends the Eclipse 3.3 software development environment. 
Oracle jDeveloper 
An IDE for building service oriented applications using the latest industry standards for Java, XML, Web services and SQL. It supports the complete development life cycle, with features for modeling, coding, debugging, testing, profiling, tuning and deploying application. 

Sample Code for Integration using JDO

To integrate JRules with third party data, you need to add the relevant code to your application. For example, to integrate third party data using JDO, you would need to add the following code:

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
import javax.jdo.Query;
 
...
 
Properties p = ... // read propertes to get the JDO configuration
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(p);
PersistenceManager pm = pmf.getPersistenceManager();
pm.currentTransaction().begin();
 
Query q = pm.newQuery(Order.class, "ID == 123456");
Collection results = (Collection) q.execute();
 
Order order = (Order)results.get(0);
 
// then use this order with a rule session
try {
// get a session provider, open a rule session
// execute the ruleset on this order (inout parameter)
// let us suppose this order is modified by the rules 
 
pm.makePersistent(order);
pm.currentTransaction().commit();
 
} catch (AnythingBadOccursException e) 
{
 
     pm.currentTransaction().rollback();
}
 
pm.close();
pmf.close();

For a similar code sample, using the Java Persistence API (JPA), go to https://glassfish.dev.java.net/javaee5/persistence/persistence-example.html and click the Putting It All Together link. For Java persistence documentation, go to http://java.sun.com/javaee/5/docs/api/javax/persistence/package-summary.html.

Related Concepts

Overview: Integrating Application Data into the XOM
XML Binding
Web Service Binding
Execution Object Model (XOM)