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).











[...] Collaboration Dashboard And in another post, he announced a Flex Data Management tutorial that’s also included in the Flex Test Drive Server. Good stuff if you’re looking to get into FDS. Kudos to one of Adobe’s Flex Evangelists! [...]
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.
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
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
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.
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.
We are in immediate need of a capable Flex Developer to develop an e-commerce experience.
Contact me @: sam@pyromediastudios.com
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
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
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?
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
Any tips on a free Flex IDE?
tnx curt
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
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
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
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…
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
I want to create new flex and hibernate application and do i need to change the properties file and create the class
Thank You
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!
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
Great Flex Samples with Christophe’s Salesbuilder Application…
Christophe Coenraets has updated his Salesbuilder application with a number of unique features that would appeal to any Flex developer. (The application is an Adobe AIR application that he’s built with Flex Builder.) Salesbuilder is sample sales for…
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.
[...] I’m not going to write a lot about FDS here, so the curious reader may want to take a look at this article for an introduction to the subject. [...]
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”
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.
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.
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 )
([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.
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.
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!
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
[...] Flex Data Management Tutorial: http://coenraets.org/blog/2007/01/flex-data-management-services-tutorial/ [...]
very interesting.
i’m adding in RSS Reader
great post.thanx
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.
Rockabilly clothes….
Cool clothes. Sissy boys wearing girls clothes. Hippie clothes. 18 doll clothes. Small dog clothes. Girls clothes. Express clothes….
very interesting
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
[...] Christophe Coenraets :: Flex Data Management Services Tutorial [...]
This is one of the best FLEX examples on web.
Thankyou very much for creating such a great examples.
[...] Christophe Coenraets :: Flex Data Management Services Tutorial [...]
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 :)
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
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
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.
thank you very much
http://www.seksene.net/index.php
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.
Thanks My Friend..
hi good thank you 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.
beauty web has-been admin thanks..
This is one of the best FLEX examples on web.
Thankyou very much for creating such a great examples.
medyum