Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Using own SQLite DB in combination with Data Management

Avatar

Level 2

Hi,

Currently on a huge project we're we are using LCDS 3.1 in combination with a AIR 2.5 client.

I've been reading "Using Adobe LiveCycle Data Services ES2 version 3.1" and I have a question. In the chapter "Building an offline-enabled application" it says on the very first line:

"You can use an offline adapter with an AIR SQLite database to perform offline fills when a desktop client is disconnected from the LiveCycle Data Services server. An offline adapter contains the SQL queries for AIR SQLite for retrieving cached items like an assembler on the server retrieves items from the data source."

However, in my experience that AIR SQLite database is not just any DB but one that Datamanagment designs and generates itself, based on the Dto the DataManagement destination is managing. The offline adapter doesn't work like an assembler at all, because the documentation says you can only override the methods pertaining to constructing the WHERE, and ORDER BY parts of the queries, not the SELECT, CREATE, FROM,... parts.

In our case, we have a database on the server, constructed according to a very specific ERD, and we have a SQLite database on the client, also constructed according to a very specific ERD. What we want to do is execute every fill, create, update, delete against the offline cache and only synchronize with the backend when we want it the synchronize (technically possible by playing with the autoMerge, autoSaveCache, autoConnect,... properties). So what part of datamanagement can we customize to use our DB instead of a generated one?

Thx in advance!

1 Reply

Avatar

Employee

You are correct in noting that Data Management does not allow you to use your own database to store offline data.  This data is exclusively managed by the LCDS library for the developer.  The intent is that the local cache is a reflection of the server data, not an independent copy.

If you have an existing database in AIR, then you will have much more direct control over the querying and updating of that data by using the SQLite APIs directly.

That being said, you can in essence replicate the data stored on the server, managed by Data Management, in the offline cache.  In an upcoming release (winter 2011) we will have a few features ('briefcases' and a 'changes-only' fill) that will make this story even more compelling for your use cases.  But even with the 3.1 functionality, you can do something like the following:

  1. Perform a fill() to collect the data you want to have available on the client, save this in the offline cache
  2. Construct an Offline Adapter Actionscript class that implements the fills you want to perform on the local data
  3. Use the DataService.localFill() API to perform all of the client application fills, turn off autoCommit.
  4. When the client is online, call commit() to store client changes and call fill() to refresh the cached data.

This should give you some ideas on how you could go about constructing your app to leverage the offline features of Data Services.

Tom