SQLAssembler: create a Flex and Java application with LCDS (LiveCycle Data Services) without server side code

LCDS 2.5 brought a new assembler, SQLAssembler. SQLAssembler lets you connect your Flex client to your database. Usually, when you read/write data with LCDS, you create your own Java adapter to handle these operations. With SQLAssembler, instead of writing the Java code for accessing the database, you configure access to the database and write the SQL for read/write/delete directly into the data-management-config.xml file (this is a configuration file used by Flex data services). Basically, you write some simple XML with some SQL for each operation, and you don’t need to write a single line of Java. But, you get a full CRUD application, with all the benefits of Flex Data Services: collaboration, conflict resolution, paging. If you need for some operations to use stored procedure instead of SQL statements, there is no problem as SQLAssemberl has support for them.

Why should you use SQLAssembler?

I will not try to fool you. Probably it isn’t good for complex applications, where you have a lot of business logic on your server. But, it could come in very handy when you need to create a simple application, maybe a quick prototype for example. And the best thing is that if, for some reason, you decide that you need a custom assembler or HibernateAssembler instead of SQLAssembler, there should be little to change in the Flex client code, if anything at all. And, as you will see in this article, I can use this assembler to create a full CRUD application for one-to-many relationship database setup.

Prerequisites

In order to be able to follow this article and to try the attached project, you need to have: Flex Builder 3, WTP (Web Tool Project) installed in Flex Builder, and LCDS 2.5 or newer. If you don’t have Flex Builder, you can download a trial from here; if you don’t have WTP installed, then check my article here; finally if you don’t have LCDS, you can download it from here. I use a combined Flex and Java project with LCDS. I have explained this kind of setup here. Finally you need to have Tomcat 5.5 installed (I created my project using Tomcat as a server for WTP deployment).

You can download the project from here (it is a pretty big download, so be patient) and you can import it in Flex Builder, using the Import Flex Builder wizard.

Finally, in the root of the project, there is a database.sql file you can use it to create the database. In my project, I used MySQL as a database server.

Database structure

The database structure is very simple: two tables, one for storing the authors and one for storing the books. One author can have as many books as needed:

sqla_db_structure

Application description

I want to create a Flex application that lets me edit these two tables (full CRUD). I want to be able to choose an author, and see what books he wrote. This is the layout of the application (I know it isn’t a beautiful one, but that’s not the point of this article :D ).

sqla_app

Read more

Flash applications can be indexed by search engines

Do you remember my article last week on Deep Linking and Flex? Well, I think it would be a good idea to read it, particularly if you don’t know how Deep Linking works in Flex. Why is that? Because Adobe has given a special Flash Player to Yahoo! and Google; that is able to index SWF files. So what does this mean? It means if you have built a Flash/Flex application which has dynamic/static data, Google and Yahoo! will be able to index it and display your application in the search result list if your app is relevant. This player lets a search engine “walk” through a Flash application in the same way a human would; it can click on buttons, change states, and make server requests for retrieving data stored on the server.

Is the world perfect, now? Definitely not, there are still some things to be worked out. But at least these search engines have a tool to index the content of millions of Flash applications. In time, people will put together SEO best practices for Flash applications, the same as we have today for HTML web sites. The best part is that you don’t have to change a thing in your existing applications in order to get indexed.

Here is the Adobe press release, and you can read about Google position on this matter here.

New content posted to the Flex Developer Center

Today, you can find three new articles in Flex Developer Center:

Well, one is not new, if you read my blog :)

← Previous Page