The amazing adventures of Doug Hughes

I recently had the opportunity to put together a really quick survey application for our booth at the Adobe Max event in Los Angeles. When I started in on this application I was extremely excited. The application contains videos, online offline syncing, and a slew of nifty Air only capabilities.

My excitement quickly wore thin when working with the new cfair.swc utility that assists with creation of local storage and facilitates online offline synchronization of data. The cfair.swc is kind of a black box. It’s extremely frustrating to try to debug when you can’t dig in and see the code.

At first I was just getting errors like “ReferenceError: Error #1065: Variable Prize is not defined.” So I probably didn’t define a Prize value object in the project or I didn’t properly define this in the metadata. No problem. After some quick corrections I was elated to see that cfair.swc had helped me properly built out my sqlite tables with all of the correct join tables and columns. Now on to saving.

When saving responses to our local database, I was perplexed to see that all of the saves I was doing were resulting in primary key values of zero. My confidence was shaken.

I also ran into ‘undefined’ errors when retrieving relational data. The source of the issue is coming from the cfair.swc but I can’t dig in to take a closer look at what has gone wrong.
While we were able to struggle through each of these issues, we still found hiccups and missing data when using the cfair.swc over a number of application sessions and over long intervals of usage. For this reason, and because of the limited amount of time I believe the correct thing to do was to move on without the cfair.swc.

I briefly considered using AirOrm (http://code.google.com/p/airorm/) but decided to switch the application over to ‘Air Active Record’ (http://jacwright.com/blog/55/air-active-record/), which I’ve used on previous projects and never had any major issues with.
I have no doubt that Adobe will continue to develop the documentation and correct any issues with cfair.swc. This is brand new code and issues are to be expected. As Adobe??s community digs in, I have no doubt that many of these problems will be corrected and resolved.

Has anyone else run into issues with somewhat complex data mappings while using this tool?

Comments on: "Local ORM issues with CFAir.swc" (1)

  1. Hello

    I see a few years have passed since you wrote this, but we are currently trying to get CFAIR working with “somewhat complex” relationships, and experiencing many frustrations.

    For 1:1 mappings the ORM resolves it all correctly, coming in from the client and saving to the server, the conflict comes back with the new PK issued by the server, and the local DB is correctly updated with the server’s PK. Perfect. And even for 1:m relationships for example, CFAIR can handle inserting one object on the Many side together with the parent object just fine (conflicts get resolved with the PK and all).

    BUT – when you add more than one child object to a parent object (locally) before doing a sync, CFAIR doesn’t issue the “next PK on the local SQLite DB” for the second child object, resulting in a crash. There is no hint in the error message that this was the underlying reason – we found this out with trial and error. The fix for this particular issue was for us to keep track of the “next available local DB PK” ourselves and assign this value to each child object we wanted to save.

    So that got us past that particular issue (which applies to 1:m and m:n). But we are still struggling with other issues. It shouldn’t be this difficult!

    Ok, so my actual question is, in today’s marketplace, have you come across any better platforms to use, if we want to accomplish cross-platform development that can run on desktops (OSX and Windows) and mobiles and that supports online/offline mode, combined with decent sync functionality? Would you say AirORM is still the best option?

    I can’t get my head around this one. Why does it seem so difficult to find a modern platform that supports this requirement? It is such a powerful concept that there must be a huge demand for it… but unfortunately the web has gone quiet on CFAIR in recent years…

    Any thoughts on this would be much appreciated.

    Kind regards,
    Louis

    Like

Comments are closed.

Tag Cloud

%d bloggers like this: