Changes for page WebObjects and Squeryl
Last modified by Ravi Mendis on 2011/04/01 11:14
From version 79.1
edited by Ravi Mendis
on 2011/03/31 23:24
on 2011/03/31 23:24
Change comment:
There is no comment for this version
To version 81.1
edited by Ravi Mendis
on 2010/11/10 04:56
on 2010/11/10 04:56
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,6 +1,6 @@ 1 -= Squeryl ~= //SQL-like// DSL inScala =1 += Squeryl ~= //SQL-like// DSL for Scala = 2 2 3 -Advantages of [[Squeryl>>http://squeryl.org/]]over EOF:3 +Advantages of Squeryl over EOF: 4 4 5 5 * Concurrent 6 6 ** Spawns multiple database connections ... ... @@ -7,23 +7,22 @@ 7 7 ** Issues database transactions concurrently 8 8 * Scala Actor compatible 9 9 ** Immutable object model/graph 10 -** Explicit transaction control 11 -* Type Safety 10 +* Strongly-typed 12 12 ** Better suited for database/business "logic". 13 13 E.g: Exploits the compiler and IDE to catch exceptions at compile time rather than at run-time. 14 -* Uses Scala Collections13 +* Uses Scala (functional) collection classes 15 15 16 16 = Migrating EOF -> Squeryl = 17 17 18 -In contrast to EOF Squeryl maintains its ORMinformation programmatically - in the classes itself and collectively in a[[schema>>http://squeryl.org/schema-definition.html]].Inkeeping with the strongly-typed philosophy of Scala,Squerylhas no dynamic component like EOF (i.e an EO model file).17 +In contrast (to EOF) Squeryl maintains its database schema information programmatically - in the classes itself and collectively in a ##schema##. And in keeping with the strongly-typed philosophy of Scala, it has no dynamic component like EOF (i.e an EO model file). 19 19 20 -EOF has the ability to generate classes in Java (and in Objective-C prior to WebObjects 4.5) becauseenforcing type has become customary in enterprise environments. We may exploit this feature of EOF to generate a Squeryl schemafrom an EO model.19 +EOF has the ability to generate classes in Java (and in Objective-C prior to WebObjects 4.5) as enforcing type has become customary in enterprise environments. We may exploit this feature of EOF to generate a Squeryl schema. 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:Therecanbe no support for entitiesclassified as ##EOGenericRecord##.23 +* Make sure **all** EO entities have a class name (including abstract many-To-many "join" tables). There's no support for entities marked as ##EOGenericRecord##. 25 25 * Mark the abstract many-To-Many join entities as ##Abstract##. 26 -* (Temporary) Ensure all the model entities are in the same package. i.e the packageis exclusiveto the model.25 +* (Temporary) Ensure all the model entities are in the same package. i.e ##model## <-> ##package## corresponds 1-to-1. 27 27 28 28 === Generating the Squeryl Schema === 29 29 ... ... @@ -39,21 +39,3 @@ 39 39 Any custom business "logic" will have to be manually re-written in Scala 40 40 41 41 {{/note}} 42 - 43 -== Differences Between a Squeryl Schema and EO Model/Classes == 44 - 45 -* Optional attributes (i.e those that ##allowsNull##) are typed as ##OptionT## 46 -* To one relationships that are not mandatory (i.e optional relationships) are also typed as ##OptionT## 47 -* To many relationships are represented as a Squeryl iterable (collection class) as opposed to a ##NSArray##. 48 - 49 -=== Use of Scala Collections === 50 - 51 -===== 1. Filtering ===== 52 - 53 -Instead of using EOQualifiers to filter EOs dynamically, you can apply the type safe filter in Scala: 54 - 55 -{{code}} 56 - 57 -def activeFiles = files.filter(_.active == true) 58 - 59 -{{/code}}