From 86981cea177fb2bc2d7bee3091bfe754cf6b075c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Thu, 28 Apr 2011 08:30:30 +0000 Subject: [PATCH] improved Q-type serialization --- .../mysema/query/scala/EntitySerializer.scala | 2 +- .../src/test/scala/test/QEmployee.scala | 20 +++++++++---------- .../src/test/scala/test/QSurvey.scala | 12 +++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/querydsl-scala/src/main/scala/com/mysema/query/scala/EntitySerializer.scala b/querydsl-scala/src/main/scala/com/mysema/query/scala/EntitySerializer.scala index 8275ee3fd..3117c827e 100644 --- a/querydsl-scala/src/main/scala/com/mysema/query/scala/EntitySerializer.scala +++ b/querydsl-scala/src/main/scala/com/mysema/query/scala/EntitySerializer.scala @@ -90,7 +90,7 @@ class ScalaEntitySerializer @Inject()(val typeMappings: TypeMappings) extends Se writer.beginObject(queryTypeName) writer.line("def as(variable: String) = new ", queryTypeName, "(variable)") writer.line("") - writer.line("val ", model.getUncapSimpleName, " = new ", queryTypeName, "(\"", model.getUncapSimpleName, "\")") + writer.line("val ", model.getUncapSimpleName, " = as \"", model.getUncapSimpleName, "\"") writer.end() // header diff --git a/querydsl-scala/src/test/scala/test/QEmployee.scala b/querydsl-scala/src/test/scala/test/QEmployee.scala index f0003d401..27d6d82bf 100644 --- a/querydsl-scala/src/test/scala/test/QEmployee.scala +++ b/querydsl-scala/src/test/scala/test/QEmployee.scala @@ -12,29 +12,29 @@ import com.mysema.query.scala.sql.RelationalPathImpl; import com.mysema.query.sql._; object QEmployee { - def as(variable: String) = new QEmployee(variable) + def as(variable: String) = new QEmployee(variable) } @Table("EMPLOYEE") @Schema("PUBLIC") class QEmployee(cl: Class[_ <: Employee], md: PathMetadata[_]) extends RelationalPathImpl[Employee](cl, md) { - def this(variable: String) = this(classOf[Employee], forVariable(variable)); + def this(variable: String) = this(classOf[Employee], forVariable(variable)); - def this(parent: Path[_], variable: String) = this(classOf[Employee], forProperty(parent, variable)); + def this(parent: Path[_], variable: String) = this(classOf[Employee], forProperty(parent, variable)); - val firstname = createString("FIRSTNAME"); + val firstname = createString("FIRSTNAME"); - val id = createNumber("ID", classOf[Integer]); + val id = createNumber("ID", classOf[Integer]); - val lastname = createString("LASTNAME"); + val lastname = createString("LASTNAME"); - val superiorId = createNumber("SUPERIOR_ID", classOf[Integer]); + val superiorId = createNumber("SUPERIOR_ID", classOf[Integer]); - val sysIdx55: PrimaryKey[Employee] = createPrimaryKey(id); + val sysIdx55: PrimaryKey[Employee] = createPrimaryKey(id); - val superiorFk: ForeignKey[Employee] = createForeignKey(superiorId, "ID"); + val superiorFk: ForeignKey[Employee] = createForeignKey(superiorId, "ID"); - val _superiorFk: ForeignKey[Employee] = createInvForeignKey(id, "SUPERIOR_ID"); + val _superiorFk: ForeignKey[Employee] = createInvForeignKey(id, "SUPERIOR_ID"); } diff --git a/querydsl-scala/src/test/scala/test/QSurvey.scala b/querydsl-scala/src/test/scala/test/QSurvey.scala index 883b85d5e..3b30b10de 100644 --- a/querydsl-scala/src/test/scala/test/QSurvey.scala +++ b/querydsl-scala/src/test/scala/test/QSurvey.scala @@ -12,21 +12,21 @@ import com.mysema.query.scala.sql.RelationalPathImpl; import com.mysema.query.sql._; object QSurvey { - def as(variable: String) = new QSurvey(variable) + def as(variable: String) = new QSurvey(variable) } @Table("SURVEY") @Schema("PUBLIC") class QSurvey(cl: Class[_ <: Survey], md: PathMetadata[_]) extends RelationalPathImpl[Survey](cl, md) { - def this(variable: String) = this(classOf[Survey], forVariable(variable)); + def this(variable: String) = this(classOf[Survey], forVariable(variable)); - def this(parent: Path[_], variable: String) = this(classOf[Survey], forProperty(parent, variable)); + def this(parent: Path[_], variable: String) = this(classOf[Survey], forProperty(parent, variable)); - val id = createNumber("ID", classOf[Integer]); + val id = createNumber("ID", classOf[Integer]); - val name = createString("NAME"); + val name = createString("NAME"); - val sysIdx54: PrimaryKey[Survey] = createPrimaryKey(id, name); + val sysIdx54: PrimaryKey[Survey] = createPrimaryKey(id, name); }