To edit or add content to this Wiki, you can simply create a new account at http://wocommunity.org/account.

Skip to end of metadata
Go to start of metadata

This set of templates will generate a Squeryl schema from an EO model. Still basic/proof-of-concept templates. Of course, you may customize them further.

Limitations

  • Single-package/single-model schemas only
  • No support for object inheritance
#if ($entity.packageName)
package $entity.packageName
#end

import java.util.Date

class ${entity.classNameWithoutPackage}(
##
##java -> Scala types go here
##
#foreach ($attribute in $entity.sortedAttributes)
#if ($attribute.javaClassName.equals("Integer")) #set( $scalaClassName = "Long" )
#elseif ($attribute.javaClassName.equals("String")) #set( $scalaClassName = "String" )
#elseif ($attribute.javaClassName.contains("BigDecimal")) #set( $scalaClassName = "BigDecimal" )
#elseif ($attribute.javaClassName.equals("NSTimestamp")) #set( $scalaClassName = "Date" )
#elseif ($attribute.javaClassName.equals("NSData")) #set( $scalaClassName = "Array[Byte]" ) #end
	val ${attribute.name}:#if ($attribute.allowsNull) Option[$scalaClassName]#else $scalaClassName#end#if (!$attribute.equals($entity.sortedAttributes.last())),
#else
#end
#end) extends _${entity.classNameWithoutPackage}(
##
##java -> Scala types go here
##
#foreach ($attribute in $entity.sortedAttributes)
#if ($attribute.javaClassName.equals("Integer")) #set( $scalaClassName = "Long" )
#elseif ($attribute.javaClassName.equals("String")) #set( $scalaClassName = "String" )
#elseif ($attribute.javaClassName.contains("BigDecimal")) #set( $scalaClassName = "BigDecimal" )
#elseif ($attribute.javaClassName.equals("NSTimestamp")) #set( $scalaClassName = "Date" )
#elseif ($attribute.javaClassName.equals("NSData")) #set( $scalaClassName = "Array[Byte]" ) #end
	${attribute.name}#if (!$attribute.equals($entity.sortedAttributes.last())),
#else
#end
#end) {
}

object $entity.classNameWithoutPackage {
}

  • No labels