Wiki source code of WebObjects and Squeryl

Version 148.1 by Ravi Mendis on 2010/11/10 03:20

Hide last authors
Ravi Mendis 81.1 1 = Squeryl ~= //SQL-like// DSL for Scala =
Ravi Mendis 54.1 2
Ravi Mendis 117.1 3 Advantages of Squeryl over EOF:
Ravi Mendis 54.1 4
5 * Concurrent
6 ** Spawns multiple database connections
7 ** Issues database transactions concurrently
8 * Scala Actor compatible
Ravi Mendis 131.1 9 ** Immutable object model/graph
Ravi Mendis 81.1 10 * Strongly-typed
Ravi Mendis 131.1 11 ** Better suited for database/business "logic".
12 E.g: Exploits the compiler and IDE to catch exceptions at compile time rather than at run-time.
Ravi Mendis 115.1 13 * Uses Scala (functional) collection classes
Ravi Mendis 54.1 14
15 = Migrating EOF -> Squeryl =
16
Ravi Mendis 117.1 17 In keeping with the strong-typed philosophy of Scala, Squeryl has no dynamic component like EOF (i.e an EO model file).
Ravi Mendis 54.1 18
Ravi Mendis 131.1 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.
Ravi Mendis 54.1 20
Ravi Mendis 141.1 21 === Preparing your EO model ===
22
Ravi Mendis 147.1 23 1. 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##.
24 1. (Temporary) Ensure all the model entities are in the same package. i.e model <-> package corresponds 1-to-1.
Ravi Mendis 141.1 25
26 === Generating the Squeryl Schema ===
27
Ravi Mendis 129.1 28 1. Create a .eogen file for your EO model as normal. Only set the ##File Names## extension to "scala".
29 1. Use the Squeryl EO Templates:
Ravi Mendis 54.1 30
Ravi Mendis 129.1 31 *
Ravi Mendis 54.1 32 ** Entity.eotemplate [[template>>WOL:Squeryl _Entity.eotemplate]]
33 ** Entity.eotemplate [[template>>WOL:Squeryl Entity.eotemplate]]
Ravi Mendis 139.1 34
35 {{note title="Note"}}
36
37 Any custom business "logic" will have to be manually re-written in Scala
38
39 {{/note}}