Your SlideShare is downloading. ×
  • Like
  • Save
Scotch On The Rocks 2011
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Scotch On The Rocks 2011

  • 532 views
Published

As of ColdFusion 9 you have the ability to create database driven applications by writing virtually no SQL statements using ORM. You can use this server-side feature on the client-side in an AIR …

As of ColdFusion 9 you have the ability to create database driven applications by writing virtually no SQL statements using ORM. You can use this server-side feature on the client-side in an AIR application.

This session will talk you through the basics of using ColdFusion ORM in AIR and how to "automagically" synchronise your local data with a remote ColdFusion 9 server. That's not all: we'll go one step further and take that ability to create database driven applications onto the mobile platform as well. Just like that.

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
532
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. Database-driven mobile AIR applications The power of ORM
  • 2. Who Am I?Steven PeetersInstructor / consultant at multimediacollegeTM• Adobe Flex, AIR, Flash Catalyst & ColdFusion Certified Instructor• Adobe Community Professional• ColdFusion User Group Manager• 12+ years of development experience• Flex & AIR since 2004• Author for Friends of ED Email: steven@multimediacollege.be LinkedIn: www.linkedin.com/in/stevenpeeters Twitter: @aikisteve Blog: www.flexpert.be Website: www.multimediacollege.be
  • 3. Topics• Database in AIR• Using ColdFusion’s ORM• Synchronising with a remote server• Applying to mobile applicationsTwitter hash tag: #airorm
  • 4. Database in AIR
  • 5. Database in AIR• SQLite
  • 6. Database in AIR• SQLite • Lightweight database
  • 7. Database in AIR• SQLite • Lightweight database • Limited type support
  • 8. Database in AIR• SQLite • Lightweight database • Limited type support • Easy to use
  • 9. Database in AIR• SQLite • Lightweight database • Limited type support • Easy to use • Available offline
  • 10. Database in AIR• SQLite • Lightweight database • Limited type support • Easy to use • Available offline • Synchronous AND asynchronous access
  • 11. Database encryption
  • 12. Database encryption• 256-bit AES encryption
  • 13. Database encryption• 256-bit AES encryption• Use EncryptionKeyGenerator to validate strength of encryption key • as3corelib on code.google.com
  • 14. Database encryption• 256-bit AES encryption• Use EncryptionKeyGenerator to validate strength of encryption key • as3corelib on code.google.com• Re-ecryption is possible
  • 15. Using ColdFusion’s ORM
  • 16. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR
  • 17. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database
  • 18. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database• Use SyncManager class
  • 19. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database• Use SyncManager class• Need to adjust DTOs with metadata
  • 20. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database• Use SyncManager class• Need to adjust DTOs with metadata• No BLOB possible :-(
  • 21. Entity Metadata
  • 22. Entity Metadata• [Entity]
  • 23. Entity Metadata• [Entity]• [Table(name=”<name>”)]
  • 24. Entity Metadata• [Entity]• [Table(name=”<name>”)]• [RemoteClass(alias=”<cfc>”)]
  • 25. Entity Metadata• [Entity]• [Table(name=”<name>”)]• [RemoteClass(alias=”<cfc>”)]• [Bindable]
  • 26. Field Metadata
  • 27. Field Metadata• [Id]
  • 28. Field Metadata• [Id]• [GeneratedValue(strategy=”INCREMENT”, initialValue=”1”, incrementBy=”1”)]
  • 29. Field Metadata• [Id]• [GeneratedValue(strategy=”INCREMENT”, initialValue=”1”, incrementBy=”1”)]• [Transient]
  • 30. Field Metadata• [Id]• [GeneratedValue(strategy=”INCREMENT”, initialValue=”1”, incrementBy=”1”)]• [Transient]• [Column(name=”<name>”, columnDefinition=”TEXT|INTEGER|REAL|DATE”, nullable=”true|false”, unique=”true|false”]
  • 31. Relationship Metadata
  • 32. Relationship Metadata
  • 33. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
  • 34. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [OneToMany(targetEntity=”<entity>”, mappedBy=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
  • 35. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [OneToMany(targetEntity=”<entity>”, mappedBy=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [ManyToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
  • 36. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [OneToMany(targetEntity=”<entity>”, mappedBy=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [ManyToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [ManyToMany(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
  • 37. Relationship Metadata
  • 38. Relationship Metadata• [JoinTable(name=”<name>”)]
  • 39. Relationship Metadata• [JoinTable(name=”<name>”)]• [JoinColumn(name=”<name>”, referencedColumnName=”<name>”)]
  • 40. Relationship Metadata• [JoinTable(name=”<name>”)]• [JoinColumn(name=”<name>”, referencedColumnName=”<name>”)]• [InverseJoinColumn(name=”<name>”, referencedColumnName=”<name>”)]
  • 41. Synchronising with remote server
  • 42. Synchronising with remote server• Always asynchronous
  • 43. Synchronising with remote server• Always asynchronous• Using SyncManager class • port • server • syncCFC • session
  • 44. Synchronising with remote server
  • 45. Synchronising with remote server• Fetching remote data • syncManager.fetch(“foo”)
  • 46. Synchronising with remote server• Fetching remote data • syncManager.fetch(“foo”)• Save remote data in local SQLite database • session.saveUpdateCache(<ArrayCollection>)
  • 47. Synchronising with remote server
  • 48. Synchronising with remote server• Reading data from local database
  • 49. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>)
  • 50. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>) • session.loadAll(<valueObject>)
  • 51. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>) • session.loadAll(<valueObject>) • session.loadbyPK(<valueObject>, <PK filter>)
  • 52. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>) • session.loadAll(<valueObject>) • session.loadbyPK(<valueObject>, <PK filter>) • session.loadByQuery(<valueObject>, <SQL where condition>)
  • 53. Synchronising with remote server
  • 54. Synchronising with remote server• Saving data to the local database
  • 55. Synchronising with remote server• Saving data to the local database • session.saveUpdate(<valueObject>)
  • 56. Synchronising with remote server• Saving data to the local database • session.saveUpdate(<valueObject>) • session.delete(<valueObject>)
  • 57. Synchronising with remote server
  • 58. Synchronising with remote server• Pushing data to the remote database
  • 59. Synchronising with remote server• Pushing data to the remote database • syncManager.autocommit = true
  • 60. Synchronising with remote server• Pushing data to the remote database • syncManager.autocommit = true • session.commit()
  • 61. What can you do with it?• Online/offline synchronisation• Use DB as (temporary) storage• Protect private data (encryption)• Colaborate with other people• ...
  • 62. What can you do with it?
  • 63. ORM on mobile devices
  • 64. How hard is it?
  • 65. ORM on mobile devices
  • 66. ORM on mobile devices• What’s available?
  • 67. ORM on mobile devices• What’s available? • SQLite database
  • 68. ORM on mobile devices• What’s available? • SQLite database • Disk access
  • 69. ORM on mobile devices• What’s available? • SQLite database • Disk access • Data contract?
  • 70. ORM on mobile devices• What’s available? • SQLite database • Disk access • Data contract? • WiFi?
  • 71. ORM on mobile devices
  • 72. ORM on mobile devices• What’s different?
  • 73. ORM on mobile devices• What’s different? • AIR 2.5 minimum
  • 74. ORM on mobile devices• What’s different? • AIR 2.5 minimum • Specify access rights in app.xml
  • 75. ORM on mobile devices• What’s different? • AIR 2.5 minimum • Specify access rights in app.xml • not much really...
  • 76. So how hard is it then? “It’s like stealing candy from a baby!”
  • 77. What can you do with it?
  • 78. Thank you Twitter: @aikisteve Email: steven@multimediacollege.be Personal site: www.flexpert.be 2 / 12