35 Comments

  1. shaun
    Posted October 3, 2007 at 7:47 am | Permalink

    Nice. Thanks for the example code.
    After playing with AIR and the embedded SQL functionality I thought I’d have a go a writing a ORM for AIR. This(metadata information) is the missing piece of the puzzle for me. I was considering an alternative approach but i prefer this option.

  2. Posted October 4, 2007 at 4:14 am | Permalink

    Adding the metadata references as compiler arguments could end up being quite a dirty process if you have a lot of metadata you want to keep and you only have that single line text input comtrol.

    Is there any plan for an option to keep all as opposed to listing them individually?

    keep-as3-metadata=ALL

  3. Gregory Pierce
    Posted October 5, 2007 at 10:01 am | Permalink

    Are you going to implement the rest of JPA (object graphs and such) or are you leaving this as an exercise for the reader? :)

  4. mloncaric
    Posted October 5, 2007 at 1:07 pm | Permalink

    omg. Thank you very much

  5. Pat Ryan
    Posted October 7, 2007 at 8:37 pm | Permalink

    I attended your session at Adobe Max in Chicago. It was one of the best sessions of the conference.
    When I returned home I started to create a simple application to show the synchronous API, asynchronous API and finally your EntityManager. I created the database outside of the EntityManager so it existed before running the EntityManager create sql.

    I noticed by running it this way the EntityManager did not populate data. It turned out to be an assumption in the typeObject method. In there you had:
    instance[item.field] = o[item.column];
    which assumed the column was upper cased which mine were not. But they would have been if I let the EntityManager create the table. The columns were the same case as the Object property that I was loading so the SQLStatement would populate the object from column name.

    I added the following and was able to get my sample application to work for synch DB, asyncDB as well as your EntityManager.

    instance[item.field] = o[item.field];
    if( instance[item.field] == null ) {
    instance[item.field] = o[item.column];
    }

    Conversely if I created the table with the EntityManager but if I used my syncAPI example it would not work because of the upperCased columns. So I also had to modify the loadMetadata method to not upperCase the column names.

    If you would like to see a test case I can send you my simple example.

    Do you have any thoughts or comments on these changes? If I have misunderstood its usage just let me know.

    Thanks again for a great session and a nice piece of work.

  6. Posted October 8, 2007 at 2:46 am | Permalink

    Hi Christophe,
    I attended the very last session that you presented at max this year. I liked your session very much it was actually my favorite this year. When i started using air to make something simple to begin with of course a contact manager was the most obvious choice. So when i ran into some bump i used your application as reference. But i am a problem with the relation in this line of code:
    “var identity:Object = map[c].identity;”
    now when i used it in my code it failed giving a null object yet the object passed to the function arguments was in fact as expected is there anyone who can explain this line within this function?

    private function createItem(o:Object, c:Class):void
    {
    var stmt:SQLStatement = map[c].insertStmt;
    var identity:Object = map[c].identity;
    var fields:ArrayCollection = map[c].fields;
    for (var i:int = 0; i<fields.length; i )
    {
    var field:String = fields.getItemAt(i).field;
    if (field != identity.field)
    {
    stmt.parameters[":" field] = o[field];
    }
    }
    stmt.execute();
    o[identity.field] = stmt.getResult().lastInsertRowID;
    }

    Thanks

  7. Pat Ryan
    Posted October 8, 2007 at 6:51 am | Permalink

    Will you be making your presentation from Adobe Max available for download.

    Thanks

  8. Pat Ryan
    Posted October 8, 2007 at 6:53 am | Permalink

    Hi NetCFmx
    If you make your code available I would take a look as I have time.

    Maybe you could try the new Adobe share beta. It has been a really easy way for me to share files.

    http://www.adobe.com/go/share

  9. Posted October 11, 2007 at 6:12 pm | Permalink

    Hi Pat,

    Thanks for taking the time to look at this i have opened an account so you can get the files they are based on the example that Christophe has posted in his contact manager. Of course i modified a few things to make sure i was able to understand the structure of the code. I am trying to leverage the usage of SQL lite and the relation with the annotation of objects. When i studied the function i could not understand what was going on in the line of code :
    “var identity:Object = map[c].identity;”

    I miss the relation between the “map[c]” and the property “.identity”.

    Anyways here is the link check it out when you can

    you can message me at wws*at*worldwidesmith*dot*com

    Thank you
    https://share.adobe.com/adc/document.do?docid=68809bd9-785e-11dc-b75f-151d3f6d9313

  10. Posted October 11, 2007 at 6:15 pm | Permalink

    Figures of course two files two links here is the missing link.

    https://share.adobe.com/adc/document.do?docid=6977581e-785e-11dc-b75f-151d3f6d9313

  11. Posted November 8, 2007 at 9:06 am | Permalink

    Great Job. I think I will use this technique as part of my flex proejct.

  12. Dan Zeitman
    Posted November 15, 2007 at 8:11 am | Permalink

    Great concept. FYI… Since the AIR BETA is a relentlessly moving target… I noted some changes in the AIR API that will need to be addressed in order for your sample to work.

    new SQLConnection(); now takes no args

    in EntityManager.as
    you will need to change line 242:

    _sqlConnection = new SQLConnection(TRUE);

    to

    _sqlConnection = new SQLConnection();

    and in the main.mxml file line 21
    change:

    _sqlConnection = new SQLConnection(TRUE);

    to

    _sqlConnection = new SQLConnection();

  13. Posted November 21, 2007 at 6:56 am | Permalink

    I have just started building my first AIR application and I was terrified that I have to go back to SQL again. After I had spent for almost two years with Rails and ActiveRecord I almost forgot that SQL exists :-)

    But actually I think that it will not take much long for some ORM project to appear.

  14. ICQManZ
    Posted November 28, 2007 at 6:27 am | Permalink

    Prodaiy ICQ za 12$ za vse.Ïðîäàþ ICQ 12$ çà âñå.
    274-693
    324-994
    564-567
    605-800
    695-769
    985-425
    132-335
    478-575
    Sviaz so mnoi ICQ 458411483. Ñâÿçü ñî ìíîé ICQ 458411483

  15. Posted December 3, 2007 at 1:37 am | Permalink

    Ricerca Farmacie. Inserisci il tuo CAP o la localita che ti interessa. CAP o localita. Se vuoi restringere la ricerca inserisci anche l’indirizzo comprare viagra on line

  16. Posted April 27, 2008 at 10:58 am | Permalink

    – UPDATE —

    Again what a great technique… I’m using it to map value objects from one to another…

    FYI — Final release of Flexbuilder 3.0 doesn’t support the option=value syntax!!!!

    Instead you must repeat the option = value:

    -keep-as3-metadata “Column”
    -keep-as3-metadata “ID”
    -keep-as3-metadata “Table”

  17. Posted June 24, 2008 at 5:18 am | Permalink

    Thanks for that I had no idea you could add your own Metadata tags to your actionscript files.

  18. Posted August 15, 2008 at 4:49 pm | Permalink

    I will be using your Simple ORM as an example of projects that use metadata in my 360 Flex presentation this next week. I hope you don’t mind.

    I am presenting on how to use metadata and Proxy to create better APIs and will site you as someone who has done this.

    [Tink]: With Flex Builder 3, if your SWC was compiled with the -keep-as3-metadata option, any project the SWC is used in don’t need to add it. It will be added automatically! Helps since the -keep-as3-metadata=ALL isn’t available.

  19. Posted August 22, 2008 at 6:26 am | Permalink

    omg. Thank you very much

  20. Posted August 22, 2008 at 6:27 am | Permalink

    Thank you very much

  21. Posted August 28, 2008 at 3:37 pm | Permalink

    thanks thanks thanks :)

  22. cryptos
    Posted September 15, 2008 at 2:00 pm | Permalink

    Thanks Google that helps me to find this site!

  23. cryptos
    Posted September 15, 2008 at 2:09 pm | Permalink

    Thank you very much! I’ll use this technique as part of my new proejct.Try to see this blog – Sexy Latina Maids

  24. Posted January 7, 2009 at 1:07 pm | Permalink

    Is there any plan for an option to keep all as opposed to listing them individually?

    keep-as3-metadata=ALL

  25. Posted January 7, 2009 at 1:07 pm | Permalink

    Thanks Google that helps me to find this site!

  26. Posted July 10, 2009 at 6:58 pm | Permalink

    Thanks for that I had no idea you could add your own Metadata tags to your actionscript files.

  27. Posted July 16, 2009 at 3:04 am | Permalink

    Has anyone tryed to map data on multiple related tables? Would be a really nice feature to be able to take orm at this level of abstractization. Tx for this class, it’s awesome ^_^

  28. Posted July 23, 2009 at 11:37 am | Permalink

    Again what a great technique… I’m using it to map value objects from one to another…

    FYI — Final release of Flexbuilder 3.0 doesn’t support the option=value syntax!!!!

    Instead you must repeat the option = value:

    -keep-as3-metadata “Column”
    -keep-as3-metadata “ID”
    -keep-as3-metadata “Table”

  29. Posted August 18, 2009 at 10:49 am | Permalink

    Хорошо написано, приятно полистать ваш сайт!

  30. Posted November 24, 2009 at 6:15 am | Permalink

    how are you baby melisa

  31. Posted December 3, 2009 at 3:05 pm | Permalink

    thanks sites

  32. Posted December 29, 2009 at 6:09 am | Permalink

    Thanks for that I had no idea you could add your own Metadata tags to your actionscript files.

  33. Posted January 9, 2010 at 9:40 pm | Permalink

    good post admin..

  34. Posted January 13, 2010 at 2:18 pm | Permalink

    Thanks for that I had no idea you could add your own Metadata tags to your actionscript files.

  35. Posted January 24, 2010 at 1:16 pm | Permalink

    Thank you for all, they are wonderful knowledges. I understand all.

8 Trackbacks

  1. By Sönke Rohde » MAX Barcelona - Short Notes on October 17, 2007 at 1:34 am

    [...] Reflexion API (describeType). Christophe has posted some code regarding the ORM approach on this blog. Now this is opens real new possibilities. Now let’s wait when Hibernate or ActiveRecord is [...]

  2. [...] DAOs used in the previous version. I might move to the annotation-based ORM approach introduced here in a future version. Finally, the “lazy loading” strategy has been improved as well and [...]

  3. By » air orm on February 23, 2008 at 7:45 am

    [...] have already been some moves in this direction, but something styled after Hibernate or ActiveRecord would be nice. Subscribe [...]

  4. By Anonymous on March 24, 2008 at 6:19 am

    Dirty Latina Maids Jennifer Luv…

    Dirty Latina Maids Jennifer Luv…

  5. By online amerikansk roulette on July 20, 2008 at 5:36 pm

    online amerikansk roulette…

    philosophizing Simons sub syntactical …

  6. By Sönke Rohde » Open Source and Flex on August 7, 2008 at 10:05 am

    [...] Chotin asked for feedback on suggested projects related to Flex. Personally I would love to see an ORM framework like suggested by Christophe Coenraets which works with [...]

  7. By FrameworkQuest 2008 Part 4: IoC With Swiz « aodz on January 16, 2009 at 6:02 am

    [...] tag. Flex has had metadata around for a while, but recently allowed a compiler option to keep custom metadata. The Swiz swc library adds two tags to the list of metadata that the Flex compiler will keep [...]

  8. [...] In this third version, we use a mini Object Relational Mapping (ORM) framework that leverages the Flex support for class annotations to entirely eliminate manually-written SQL statements. This is an approach I first explored at MAX 2007 (see original blog post here). [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>