WebObjects and Squeryl
Version 150.1 by Ravi Mendis on 2010/11/10 03:18
Squeryl = SQL-like DSL for Scala
Advantages of Squeryl over EOF:
- Concurrent
- Spawns multiple database connections
- Issues database transactions concurrently
- Scala Actor compatible
- Immutable object model/graph
- Strongly-typed
- Better suited for database/business "logic".
E.g: Exploits the compiler and IDE to catch exceptions at compile time rather than at run-time.
- Better suited for database/business "logic".
- Uses Scala (functional) collection classes
Migrating EOF -> Squeryl
In keeping with the strong-typed philosophy of Scala, Squeryl has no dynamic component like EOF (i.e an EO model file).
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.
Preparing your EO model
- 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.
- (Temporary) Ensure all EO entities are in the same package
Generating the Squeryl Schema
- Create a .eogen file for your EO model as normal. Only set the File Names extension to "scala".
- Use the Squeryl EO Templates: