Flex Data Management Services Tutorial

As part of the Flex Test Drive Server, I wrote a new Flex Data Management Services tutorial. The tutorial takes you through the full FDMS application development life cycle: Java assembler, destination, and client application. Additional topics include:

  • Controlling when changes are sent to the server
  • Controlling client synchronization (autoSyncEnabled)
  • Single Item vs Batch Updates
  • Conflict resolution
  • Locking strategies
  • Fill queries
  • Single Objects vs Collections

Click here to open the tutorial PDF document.

Your feedback on the tutorial and on the Flex Data Management Services in general is appreciated.

Thanks!
Christophe

Note: Refer to this post to download fds-tomcat.zip

ERRATA: On page 4: “On the Java Settings page, specify fdms-tomcat/classes as the Default output folder, and click Finish”. The name of the folder is incorrect: it should read: Specify “fds-tomcat/classes” as the Default output folder (The screen shot is correct).

  • Pingback: Got RIA? » Blog Archive » FDS Examples With Tomcat By Christophe Coenraets()

  • Christoph,

    There’s some confusion regarding the pdf doc.

    On page 4, you mention, specify fdms-tomcat/classes while in the screenshot, it says fds-tomcat/classes. Again, the folder does not exist. This is confusing and may be wrong. Please advise.

  • christophe

    Hi,
    Good catch. The screen shot is right: it is fds-tomcat/classes. fds-tomcat refers to the name of the project. So “fds-tomcat\classes” actually points to C:\fds-tomcat\webapps\ROOT\WEB-INF\classes (assuming you unzipped in c:\).
    Thanks,
    Christophe

  • amjad

    Hi, I would like to get the tutorial to work with MYSQL. I was able to create and pouuplate the database.

    Could you please outline the changes required to config files etc so that I could start tomcat in eclipse and run the pages in the browse

  • christophe

    Amjad,
    To get the tutorial to work with MySQL, all you need to do is change the JDBC connection parameters in WEB-INF\src\flexdemodb.properties (and make sure this file get copied to WEB-INF\src\flexdemodb.properties). The MySQL parameters should look like this:
    jdbc.driver=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql:///your_db_name
    Also, in the create() method of flex.tutorial.fdms.ProductDAO, comment out the following line of code
    ResultSet rs = s.executeQuery(“CALL IDENTITY()”);
    and uncomment
    ResultSet rs = s.executeQuery(“SELECT LAST_INSERT_ID()”);
    This is the MySQL syntax to get the value of the autogenerated key.

  • Grace Tweedie

    I am looking at your site based on Kevin Hoyt’s (from adobe) suggestion in his online seminar that I did yesterday. I am looking at all of this and it all seems a bit over my head. I am really wanting to get into Flex, however, I am looking for a simple gradient to start at. I know some very basic stuff in it already just from some of the help options and so forth. However, I would like to just roll on learning more about it, I wondered if you know of a simple place to start or what I should learn to begin with, etc. I am factually a graphic designer (Photoshop & InDesign), but I have got to get into Flex in order to pull off anything good in a whole project I am doing (creating a whole system with some nice GUI connected to databases, etc). I have my own programmer who is really getting into Java at the moment, but I have to roll too. I just have to roll in the right direction and learn as much as I can with the minimum of lost time. Can you give me some direction. Thank you in advance. Please don’t post this comment as it is more of a request for help.

  • Sam

    We are in immediate need of a capable Flex Developer to develop an e-commerce experience.

    Contact me @: sam@pyromediastudios.com

  • Steve

    Christophe,

    I’m currently researching FDS and JAVA for an upcoming project. I’m not a JAVA developer – but it’s something I am working on at the moment. Anyway – do you suggest any design patterns or ways of breaking up larger applications – FDS side? For example an App which has 8 main tabs with multiple sub-tabs each with datagrids / forms?

    Any suggestions for further reading would great,

    Thanks

  • rakri

    Hi Christophe ,
    I’ve seen all of your flex tutorial .
    thanks ! all are good.
    Now , i’m waiting for a sample with flex and hibernate where is two tables for example in the database.
    rakri

  • Wajid Ali

    thanks Christophe, surely this tutorial is going to help me in my project.

    Everything is fine & running, just one thing, in Eclipse(having Flex perspective) the inventory.mxml cannot be shown in design mode, it prompts with an error “An unknown item is declared as the root of your MXML document. Switch to source mode to corret it”
    I found out that its pointing to flex-config.xml file & says “” As unknown configuration variable

    Any Idea?

  • Martin

    A reply to Wajid Ali:

    I got the same error with almost all my mxml files when I restart Felx Builder, a Google search revealed that a few others have the same problem too (and it lead me tp your entry in this blog)

    It seems to be a bug and the solution is quite simple:

    Go to your mx:Application tag and insert a line break after the namespace declaration, like so:

    […]xmlns:mx=”http://www.adobe.com/2006/mxml” [line break]
    layout:absolute[…]

    After doing so the error will miraculously disappear, now you can even remove the line break.

    But the error will return when you restart Flexbuilder, unless you have that line break after the xmlns-declaration.

    HTH, Martin

  • Curt

    Any tips on a free Flex IDE?

    tnx curt

  • VJ

    Hi Christophe,

    I am a Flex newbie. I am following the tutorial from your pdf document. I get the following error in flex-config.xml

    “unknown configuration varialbe’compiler.keep-as3-metadata'”

    I have no clue how to fix this error. I would really appreciate if you could help.

    Thanks.
    VJ

  • Sebastien

    Great examples!!

    I made a tiny application that has to make some calculation. So I have to transform remote data in variables. I couldn’t do it with HTTPService or WebService as with those objects I can only do data binding.

    So I made an “XMLLoad” class with an EventDispatcher to parse the xml in a variable.
    Is there another way to do that?

    And how to do this with a WebService?

    Thanks.
    Seb

  • Gene

    FYI… When running the tutorial, there is a bug that I was able to recreate. If you click on a field in a row to edit (say category), but then immediately click on that row’s ID field, followed by clicking the delete button, the row WILL be deleted in any other client connected and on the server. However, the row will not be deleted from the client that actually performed the delete. I was able to recreate this in both IE7 and Firefox 2 on XP. Not a big deal, but just thought I’d mention it.

    -Gene

  • Tolga Erdogus

    This is all nice and very exciting but I need an additional tutorial on how to “secure” hibernate queries. What should one use for an authentication layer/technology, what kind of code needs to be written in flex to login and authenticate (using what kind of server side technology?) and finally how and where to build a list of priviliges to authorize certain users to run certain queries and not allow other to…

  • Oscar

    This is great material. There has been an increasing interest in the Spanish speaker Flex community for material such as this. Would you mind if I translate this material to Spanish and make available in the Flex Spanish speaking forums?

  • Good Tutorial …
    Hi can u post a tutorial on flex hibernate java

  • shridhar

    I want to create new flex and hibernate application and do i need to change the properties file and create the class

  • Thank You

  • Andrew

    Works great, perfectly actually. The problem is that this Tomcat server has been modified in such a way that the projects developed here can’t be migrated. Can you provide a list of all the modifications to the “standard” FDS configuration files that you put in this project? I’ve been trying to track them all down but it seems the messaging service is still throwing errors when I deploy on a full version of Tomcat. Thanks!

  • Salvo

    Hi all,
    Christoph thanks a lot for you job is really great.
    I found a problem using the tutorial, when I created the flex project(inventory.mxml).
    Eclipse give me back the following error
    “unknown configuration variable compiler.keep-as3-metadata”.
    I tried to use the suggestion coming from
    “Martin on February 5th, 2007” but nothing changed.
    Can somebody help me ?
    thanks in advaced
    Salvo

  • Pingback: RIA pedia - Rich Internet Applications - Its all about the user experience!()

  • Hi, was doing a search on the error “An unknown item is declared as the root of your MXML document.” and came across your site. Great read btw. Anyway, didn’t find the answer here or anywhere else for that matter so I just went to messing around and found a fix/work a round or whatever you wanna call it.

    Im using Flex CS3 Beta to build my app and have it set up for AIR. In the top of my app file it had and the error was gone and hasn’t been back since. When you’re done working on it, you can change it back to the mx:WindowedApplication and all should be fine.

    Just thought I would share that.

  • Pingback: Ezmo Developer Blog » Using Flex Data Services with Spring and Hibernate()

  • andy

    Hi ,

    I was trying to connect to oracle database using FDMS but when I run the mxml file in browser and when I click on Getdata button which does the same thing “ds.fill(products)” but it does not retrieve the result from Database and it shows nothing on the command prompt of server. What can be the possible error? when there was error in the query it was giving error on server command prompt as “Numeric Overflow” but when the query was fine it showed nothing on command prompt just the message “server startup in 9340 ms”

  • mub

    Hi,

    I followed all the steps of your tutorial but when I am running inventory.mxml in browser I am getting this error:-

    [FaultEvent fault=[RPC Fault faultString=”Send failed” faultCode=”Client.Error.MessageSend” faultDetail=”Channel.Connect.Failed error undefined url:’rtmp://localhost:2038′”] messageId=”62C35CB9-9D9F-D25D-C1E9-088946B1DB92″ type=”fault” bubbles=false cancelable=true eventPhase=2]

    Could you please help? no other application is using 2038 port. I also disabled my pc firwall as-well but still I am getting the same error.

    Any comments would be appreciated.

  • gmcgoldrick

    The Channel.Connect.Failed error is a red herring.

    The problem is that you need to “build” the server-side project. If you look at the tomcat log, it will show that it cannot find the ProductAssembler class.

    Maybe the tutorial could be updated to add in this important step.

  • max

    Christophe, thank u so much for interesting and useful bundle. This clear alot for me. But im looking for some implementations and really can’t find any to meet my needs. Could anyone post links or any related materials on topic. I need some solution to secure destinations as well as say different application modules based on roles.

    thanks in advance )

  • cheewai

    ([RPC Fault faultString=”Send failed” faultCode=”Client.Error.MessageSend” faultDetail=”Channel.Connect.Failed error undefined url:’rtmp://localhost:2037′”]
    )

    I getting this error when I try to use the data management, this is my configuration. I using EJB as persistent layer.

    ejb3
    FOModelBean/remote
    application

    20

    Please advice.

  • Pepe Martínez

    I haven’t found a solution for the problem of the error “unknown configuration variable ‘compiler.keep-as3-metadata'” found at flex-config.xml.

    I would appreciate any advice.

    Regards.

  • ttnspy

    I’m a have small problem , can any one help me? Please
    I make a project which very similar to Product project(in example).

    1) Have Assembler class: I work correctly

    package flex.samples.stock;

    import java.util.List;
    import java.util.Collection;
    import java.util.Map;

    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;

    public class StockAssembler extends AbstractAssembler {

    public Collection fill(List fillArgs) {
    StockService service = new StockService();
    System.out.print(fillArgs.size());
    return service.getStocks();
    }

    public Object getItem(Map identity) {
    StockService service = new StockService();
    return service.getStock(((Integer) identity.get(“StockId”)).intValue());
    }

    public void createItem(Object item) {
    StockService service = new StockService();
    service.create((Stock) item);
    }

    public void updateItem(Object newVersion, Object prevVersion, List changes) {
    StockService service = new StockService();
    boolean success = service.update((Stock) newVersion);
    if (!success) {
    int stockId = ((Stock) newVersion).getStockId();
    throw new DataSyncException(service.getStock(stockId), changes);
    }
    }

    public void deleteItem(Object item) {
    StockService service = new StockService();
    boolean success = service.delete((Stock) item);
    if (!success) {
    int stockId = ((Stock) item).getStockId();
    throw new DataSyncException(service.getStock(stockId), null);
    }
    }

    }

    some require class is ok.
    2) I configure in data-management-config.xml

    flex.samples.stock.StockAssembler
    application

    20

    3) My client app:
    I use :
    ….

    ……
    ds.fill(stocks); –> Problem here
    When I run this app, The method fill() of StockAssembler on the server work correctly (i use printout to debug) . But variable stocks can’t get the return value,it is a empty list.

    Please help me!

  • ttnspy

    Hi all!
    I’m a have small problem , can any one help me? Please
    I make a project which very similar to Product project(in example).

    1) Have Assembler class: I work correctly
    package flex.samples.stock;

    import java.util.List;
    import java.util.Collection;
    import java.util.Map;

    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;

    public class StockAssembler extends AbstractAssembler {

    public Collection fill(List fillArgs) {
    StockService service = new StockService();
    System.out.print(fillArgs.size());
    return service.getStocks();
    }

    public Object getItem(Map identity) {
    StockService service = new StockService();
    return service.getStock(((Integer) identity.get(“StockId”)).intValue());
    }

    public void createItem(Object item) {
    StockService service = new StockService();
    service.create((Stock) item);
    }

    public void updateItem(Object newVersion, Object prevVersion, List changes) {
    StockService service = new StockService();
    boolean success = service.update((Stock) newVersion);
    if (!success) {
    int stockId = ((Stock) newVersion).getStockId();
    throw new DataSyncException(service.getStock(stockId), changes);
    }
    }

    public void deleteItem(Object item) {
    StockService service = new StockService();
    boolean success = service.delete((Stock) item);
    if (!success) {
    int stockId = ((Stock) item).getStockId();
    throw new DataSyncException(service.getStock(stockId), null);
    }
    }

    }

    some require class is ok.
    2) I configure in data-management-config.xml

    flex.samples.stock.StockAssembler
    application

    20

    3) My client app:
    I use :
    ….

    ……
    ds.fill(stocks); –> Problem here
    When I run this app, The StockAssembler on the server work correctly (i use printout to debug) . But variable stocks can’t get the return value,it is a empty list.

    Please help me

  • Pingback: Building a LiveCycle Data Service Application « i am josh()

  • very interesting.
    i’m adding in RSS Reader

  • great post.thanx

  • pushkar

    Hi Cristophe,

    I was going through the examples of yous, but none of the channels (be it my-rtmp/amf) are working for some peculiar reason. Is it that we need to install something for getting them work ? Please let me know
    as I am stuck with this for quite some time.

    Thanks.

  • Pingback: Maternity clothes.()

  • very interesting

  • gaurav

    In your example in the pdf you are not using ds.createItem anywhere…!! can you please tell a way to use createItem from the client side.

  • Good Tutorial …
    Hi can u post a tutorial on flex hibernate java

  • very interesting.

  • interesting ;)

  • Thank you very much for this information. I like this site

  • thank you very much.

  • ooo süper this is. fantastik

  • thanks

  • Thank you very much

  • Sohbet

    thanks you administrator

  • Güzel Sözler

    very much

  • danke admin

  • tek yuo admin

  • thanks for you

  • Pingback: About LCDS « It’s all about RIA()

  • This is one of the best FLEX examples on web.
    Thankyou very much for creating such a great examples.

  • Pingback: Adobe LCDS « SrikanthCreative Mind’s Weblog()

  • Madhu

    Hi Chris

    Myself madhu i am new to flex ,i need your help in learning flex,and at the same time iam also looking for job on flex,i would be a very helpfull if can send me some FAQ’s . my mail id is madhu52280@gmail.com

    Thanks & Regards
    Madhu

  • […] Christophe Coenraets :: Flex Data Management Services Tutorial […]

  • Hi SohbetLi

  • thanks

  • tşk :)

  • bitti :)

  • kayfun

    man, you are the best, av been reading a book on flex and java and got to this particular topic,it was giving me headache until i came across you tutorial, thanks a lot man, you are good. But i cant find a download site for fds-tomcat.zip, can u send a link so i can try the samples, thanks

  • thenks sohbet, chat, muhabbet, sohbet odaları,sohbet sakarya,sohpet,sohbet oyun radyo,İslami Sohbet, Dini Sohbet, İslami Site, Dini Site, İslami Chat, İslami Radyo, iSlami Sohbetler, Dini Sohbetler, DiniSohbet, iSlamiSite, Dini Chat, iSlami Arkadaşlık

  • ats

    Happy new year!

  • I was able to recreate this in both IE7 and Firefox 2 on XP. Not a big deal, but just thought I’d mention it.

  • Hi can u post a tutorial on flex hibernate java

  • Happy new year!

  • The Channel.Connect.Failed error is a red herring.

  • thanx

  • sex

    very good sites

  • Thanks My Friend..

  • In your example in the pdf you are not using ds.createItem anywhere…!! can you please tell a way to use mobilya dekorasyon http://sanaldekor.com createItem from the client side.

  • Vivek

    Thanks for the tutorial. Is is possible to trigger The fill method for all clients from the server side (Java that is) ? I need to populate some managed data on the flex side and when any changes are made to this data from the client, it is propogated back to the backend database and subsequently reflected on all clients.
    But, the backend data can be changed without using flex also. So I need to run a scheduler from Java to retrieve the latest data. Is there a way to triggger a refresh of data on all clients using data management from the Java side? I am currently using the messaging service to do this but want to move to the data management service.

  • This is one of the best FLEX examples on web.
    Thankyou very much for creating such a great examples.
    medyum

    • useful article and comments.

      thank you

  • Nice post. This post is different from what I read on most blog. And it have so many valuable things to learn. Thank you for your sharing!

  • Very good, congratulations article

  • I am grateful to you for this great content.

  • ssk

    Works great, perfectly actually. The problem is that this Tomcat server has been modified in such a way that the projects developed here can’t be migrated. Can you provide a list of all the modifications to the “standard” FDS configuration files that you put in this project? I’ve been trying to track them all down but it seems the messaging service is still throwing errors when I deploy on a full version of Tomcat. Thanks!

  • thanks admin

  • web tasarımı için güzel bir site

  • I haven’t found a solution for the problem of the error “unknown configuration variable ‘compiler.keep-as3-metadata’” found at flex-config.xml.

    I would appreciate any advice.

  • I have listed only blogs whose primary focus is climate

  • admin nice web page
    thank

  • i do not see the article, error page. The tutorial is missing. can any one direct me the to the flex+spring+LCDS example.

    Thank you

  • nice article and topic we can discuss for better

  • 3 hafta sonra hazır, ama..

  • Good site, thanks for informations.

  • nice sharing.. thanks..

  • ücretsiz arkadaşlık sitesi arkadaş arama

  • köpek eğitimi köpek eğitim

  • web tasarımı internet sitesi google optimizasyon google da ilk sayfada çıkmak

  • bayan eskort istanbul

  • bayan ve erkek eskort istanbul

  • 5651 sayılı log yasası çözümleri

  • Hi this message is very beautiful and useful information to your offers. Thank you for information.

  • thank you for post…
    dizi izle, e-dizi, dizi

  • it s about flex dat. it s hard topici think. i m wordking about siemens data

  • fotoğrafcı

  • mankaen ve model ajansı

  • manken model ajansı

  • Thank you for post.
    thanx for this article. i follow tvwatch blogs about wacth
    Dizi izle, online dizi, yabancı diziler, yerli dizileri, dizi özetleri, dizi fragmanları, dizi seyret, dizicik, dizi müzikleri, dizi resimleri, dizi tekrarı, tüm diziler, Canli dizi, Diziler, DiziCik

  • kartepe haber, kartepe haberleri, izmit haber

  • web site yapımı için en ideal adres

  • turkiye nin en guzel ve en aktif firma rehberi sitesi binlerce firmaya ulaşabilirsiniz

  • So far has been working fine for our business

  • Turkiye restaurant

  • News portal in Turkey and beautiful day

  • Increase web site traffic to your web site hit visitor you send users to the site of the hit site,hit sitesi

  • marka tescil

  • avukat,turkiye lawyer,türk avukat

  • Hit Sitesi,hit,web trafik artırma,web site hit artırma

  • turkey firma rehberi

  • marka tescili,tredeamark

  • hit site,web trafik artırma

  • Thank you very much…

  • thanks thank man

  • thank you admin eyw.

  • hello admin thankss

  • Tankhs admin

  • tanhks admin

  • Dekorasyon firması zorlugroup http://www.dekorasyonfirmasi.com dekoras

  • thank you for your usefull information.

  • thank you admin eywww

  • thanks for elagance subject.

  • Thanks for sharing this with us!

  • thanks for sharing.

  • Hey, was just browsing on the internet looking for some information and came

    across your site. I am impressed by the information that you have on this

    site.
    Thanks for sharing this with us!

  • thanks admin very nice tutorial

  • teşekkürler…..

    Matbaa

  • Chaz

    Hi Chris,

    I need you help, please tell me how I can contact you or how you want to contact me.

    Thanks
    Chaz

  • CPR Test

    It is very happy to write comment on this blog really you had provided very informative post in this blog. Really it had made me know something today. Thanks for the stuff which made me realized some thing.CPR Test

  • firma ekle

  • ankara avukat ve hukuk konularında sizlere hizmet verir

  • Great Share! You made some decent points there. I looked on the internet for the issue and found most individuals will go along with with your website.

  • really liked your presentation on QCON a few weeks ago. I could really tell you are very good at what you do. My compliment for that.

    I have a question though: I some environments like banks etc Flash plugin is disabled in the browser (security wise). How can we still use this technology wit

  • I am beginner in Flex.
    But as I see, it is better then ajax

  • built-in online service that allows you to find and world brands of built-in products you can buy

  • Kasko hesaplama siz sadece araç bilgilerinizi bize yollayın size en kısa sürede kasko hesaplama yaparak araç kasko bedelini size bildirelim çokda ekonomik fiyatlara kasko yaptırabilirsiniz

  • En uygun kasko trafik sigortaları

  • This is one of the best FLEX examples on web

  • eklediğin için teşekkürler

  • looks awesome thanks!

  • savur mardin köyleri

  • very blogg godd

  • blog good big

  • It is truly a great and helpful piece of info. I’m glad that you just shared this useful info with us. Please keep us informed like this. Thank you for sharing.

  • There was an error downloading the page.

  • Oo Baby Çok Gozel Olmiş Eline Sağlık

  • Hello There. I discovered your blog the use of msn. This is a really well written article. I’ll be sure to bookmark it and come back to read more of your helpful information. Thank you for the post. I’ll certainly return.

  • I just want to say I’m all new to blogging and site-building and definitely loved this web site. Almost certainly I’m likely to bookmark your site . You absolutely have great articles. Bless you for sharing your web page.

  • thx you .
    come avsa island travel

  • Avşa adasi avşa travel come all avsa island

  • avşa island travel come all avsa island

  • Great article .Congratulations for this !

  • Superb website in this article! Additionally your site loads up speedy! Just what exactly webhost are you working with? Should i buy your internet marketer backlink inside your host? I’d like our web-site crammed as promptly because your own hehe

  • I think Usm Business Systems gives the best Data Management Services.

  • Güzel çalışma ellerinize sağlık Başarılarının devamını dilerim

  • This is a good articles, Thank you so much.

  • very good

  • nice very good. good night

  • goood very nice

  • goood very nice

  • This is great.. Thanks so much

  • I need you help, please tell me how

  • obrigado amigosss

  • Good post, thank u this informations.

  • mass production, cost-effectiveness and quality of production we

  • goood very nice

  • Good post, thank u this informations.

  • paylaşım için teşekkürler…

  • Thank You ‘ve Add to Archive

  • paylaşım için teşekkürler

  • thanks for post…

  • Good post thanks a lot

  • Good post, thank

css.php