If you have ever used Hibernate, JPA or any other object-relational mapping (ORM) framework, you'll know that Session/EntityManager does all the hard work. However, there is no Session/EntityManger on the client side.
Athena Framework for Flex offers a Flex client side UnitOfWork that acts like Session/EntityManager. It help you track changes, load partial objects and resolve relationships.
Adobe Flex's test drive sample application does not show much about object management on the client side. We'll develop a similar sample application but with powerful object manipulation functionalities.
1. Download and install Athena Framework (open source, under the same license as BlazeDS) from http://www.athenasource.org/downloads/index.php?set=flex
2. Create a Java project as your server side ;
3. Create entities;
4. Create a Java service class:
public class EmpService extends AbstractService {
...
public Object saveEmployee(Employee employee) {
Object saveEmployee = doPerisist(employee, false);
log.info("Employee saved: " + employee);
return saveEmployee;
}
}
5. Create a Flex project;
6. Generate ActionScript classes;
7. Use UnitOfWork to save multiple objects to the server side.
Detail of each step is available at http://www.athenasource.org/flex/basic-tutorial.php.
+