Changes for page WebObjects and Squeryl
Last modified by Ravi Mendis on 2011/04/01 11:14
From version 163.1
edited by Ravi Mendis
on 2011/04/01 11:14
on 2011/04/01 11:14
Change comment:
There is no comment for this version
To version 167.2
edited by Ravi Mendis
on 2011/04/01 11:14
on 2011/04/01 11:14
Change comment:
Changed document parent to [xwiki:documentation.Home.How-tos.WebObjects with Scala.WebHome].
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,0 +1,1 @@ 1 +documentation.Home.How-tos.WebObjects with Scala.WebHome - Tags
-
... ... @@ -1,0 +1,1 @@ 1 +webobjects|scala|squeryl|eof - Content
-
... ... @@ -1,6 +1,6 @@ 1 1 = Squeryl ~= //SQL-like// DSL in Scala = 2 2 3 -Advantages of [[Squeryl>>http://squeryl.org/]] over EOF: 3 +Advantages of [[Squeryl>>url:http://squeryl.org/||shape="rect"]] over EOF: 4 4 5 5 * Concurrent 6 6 ** Spawns multiple database connections ... ... @@ -9,42 +9,38 @@ 9 9 ** Immutable object model/graph 10 10 ** Explicit transaction control 11 11 * Type Safety 12 -** Better suited for database/business "logic". 13 - 12 +** Better suited for database/business "logic". 13 + E.g: Exploits the compiler and IDE to catch exceptions at compile time rather than at run-time. 14 14 * Uses Scala Collections 15 15 16 16 = Migrating EOF -> Squeryl = 17 17 18 -In contrast to EOF Squeryl maintains its ORM information programmatically - in the classes itself and collectively in a [[schema>>http://squeryl.org/schema-definition.html]]. In keeping with the strongly-typed philosophy of Scala, Squeryl has no dynamic component like EOF (i.e an EO model file). 18 +In contrast to EOF Squeryl maintains its ORM information programmatically - in the classes itself and collectively in a [[schema>>url:http://squeryl.org/schema-definition.html||shape="rect"]]. In keeping with the strongly-typed philosophy of Scala, Squeryl has no dynamic component like EOF (i.e an EO model file). 19 19 20 20 EOF has the ability to generate classes in Java (and in Objective-C prior to WebObjects 4.5) because enforcing type has become customary in enterprise environments. We may exploit this feature of EOF to generate a Squeryl schema from an EO model. 21 21 22 22 === Preparing your EO model === 23 23 24 -* Make sure **all** EO entities have a class name (including abstract many-To-many "join" tables). FYI: There can be no support for entities classified as ##EOGenericRecord##.25 -* Mark the abstract many-To-Many join entities as ##Abstract##.24 +* Make sure **all** EO entities have a class name (including abstract many-To-many "join" tables). FYI: There can be no support for entities classified as {{code language="none"}}EOGenericRecord{{/code}}. 25 +* Mark the abstract many-To-Many join entities as {{code language="none"}}Abstract{{/code}}. 26 26 * (Temporary) Ensure all the model entities are in the same package. i.e the package is exclusive to the model. 27 27 28 28 === Generating the Squeryl Schema === 29 29 30 -1. Create a .eogen file for your EO model as normal. Only set the ##File Names##extension to "scala".30 +1. Create a .eogen file for your EO model as normal. Only set the {{code language="none"}}File Names{{/code}} extension to "scala". 31 31 1. Use the Squeryl EO Templates: 32 +1*. _Entity.eotemplate [[template>>doc:WOL.Home.EOGenerator.EOGenerator Templates and Additions.Squeryl _Entity\.eotemplate.WebHome]] 33 +1*. Entity.eotemplate [[template>>doc:WOL.Home.EOGenerator.EOGenerator Templates and Additions.Squeryl Entity\.eotemplate.WebHome]] 32 32 33 -* 34 -** Entity.eotemplate [[template>>WOL:Squeryl _Entity.eotemplate]] 35 -** Entity.eotemplate [[template>>WOL:Squeryl Entity.eotemplate]] 36 - 37 37 {{note title="Note"}} 38 - 39 39 Any custom business "logic" will have to be manually re-written in Scala 40 - 41 41 {{/note}} 42 42 43 43 == Differences Between a Squeryl Schema and EO Model/Classes == 44 44 45 -* Optional attributes (i.e those that ##allowsNull##) are typed as##OptionWO:T##46 -* To one relationships that are not mandatory (i.e optional relationships) are also typed as ##OptionWO:T##47 -* To many relationships are represented as a Squeryl iterable (collection class) as opposed to a ##NSArray##.41 +* Optional attributes (i.e those that {{code language="none"}}allowsNull{{/code}}) are typed as {{code language="none"}}Option[WO:T]{{/code}} 42 +* To one relationships that are not mandatory (i.e optional relationships) are also typed as {{code language="none"}}Option[WO:T]{{/code}} 43 +* To many relationships are represented as a Squeryl iterable (collection class) as opposed to a {{code language="none"}}NSArray{{/code}}. 48 48 49 49 === Use of Scala Collections === 50 50