


Note: This article was created based on Flex 2. Minor changes in the description and code may be necessary before it can be applied to Flex 3.
Important note: Effective with the release of Adobe LiveCycle ES, the Adobe Flex Data Services 2 server product has been rebranded as a Solution Component of LiveCycle ES. This article was written based on Flex Data Services but will likely work as is with LiveCycle Data Services ES. Any articles referring to or using ColdFusion and Flex Data Services are not compatible with LiveCycle Data Services ES. To learn about the new capabilities of LiveCycle Data Services ES, see the tutorials in the LiveCycle Developer Center and read about Adobe LiveCycle Data Services ES.
This article introduces DAOFlex, an open-source tool that automates some of the routine tasks in developing Adobe Flex 2 business applications. Specifically, DAOFlex can take a SQL query and a simple Java class and automatically generate, compile, and prepare all required files for the deployment of a data-driven Flex 2 application.
If you're skeptical about code generator claims, then read this article and examine the rich Internet application that we developed using DAOFlex. Hopefully, this article will ignite your interest in code generators and the DAOFlex tool.
Important note: Effective with the release of Adobe LiveCycle ES, the Adobe Flex Data Services 2 server product has been rebranded as a Solution Component of LiveCycle ES. This article was written based on Flex Data Services but will likely work as is with LiveCycle Data Services ES. Any articles referring to or using ColdFusion and Flex Data Services are not compatible with LiveCycle Data Services ES. To learn about the new capabilities of LiveCycle Data Services ES, see the tutorials in the LiveCycle Developer Center and read about Adobe LiveCycle Data Services ES.
An SQL statement (or a stored procedure) that generates the data for your application; for example:
select * from Employee where startDt < :someStartDate
The definition of an abstract Java class, annotated with an SQL statement plus a few metatags that specify the name of the database, update requirements, and so forth. For example:
/**
* @daoflex:service pool=jdbc/theriabook
*/
import java.util.List;
public abstract class Employee{
/*
* @daoflex:sql transferType= EmployeeDTO[]
* sql=:select * from Employee where startDt < :startDate ::
* tableName=EMPLOYEE
*
* keyColumns=EMP_ID
* updateWhere=key_and_modified
* /
public abstract List getEmployees(Date startDate);
}
Yakov Fain is a managing principal of Farata Systems, a consulting, training, and software development company. He has written several Java books and dozens of technical articles. Recently, he co-authored the book "Rich Internet Applications with Adobe Flex and Java" (www.theriabook.com). Sun Microsystems has nominated and awarded Fain the title Java Champion. He teaches Java and Flex 2 at New York University part time. He is an Adobe Certified Flex Instructor. Fain is editor-in-chief of Flex Developers Journal and an enterprise editor of Java Developers Journal. He leads the Princeton Java Users Group and a special interest group on RIAs for the New York Software Industry Association. Fain holds BS and MS degrees in applied math.
Victor Rasputnis is a managing principal of Farata Systems. He's responsible for providing architectural design, implementation management, and mentoring to companies migrating to XML Internet technologies. He holds a Ph.D. in computer science from the Moscow Institute of Robotics.
Anatole Tartakovsky is a managing principal of Farata Systems. He's responsible for the creation of frameworks and reusable components. Anatole authored a number of books and articles on AJAX, XML, Internet, and client-server technologies. He holds an MS in mathematics.