Scala Project + Scala Querydsl 2.7.0

57 views
Skip to first unread message

Giuliano Costa

unread,
Jul 29, 2012, 1:02:29 PM7/29/12
to quer...@googlegroups.com
Hello,


I´m followed Blog example(http://blog.mysema.com/2010/09/querying-with-scala.html) and can not run in my project. Exists any other examples utilization scala+querydsl?

Timo Westkämper

unread,
Jul 29, 2012, 2:26:53 PM7/29/12
to Querydsl on behalf of Giuliano Costa
Hi.

This blog post might be a bit out of date. The reference docs are up to date http://www.querydsl.com/static/querydsl/2.7.0/reference/html/ch02s08.html

Br,
Timo


On Sun, Jul 29, 2012 at 8:02 PM, Querydsl em nome de Giuliano Costa <querydsl+noreply-APn2wQcNHpRKUFb...@googlegroups.com> wrote:
Hello,


I´m followed Blog example(http://blog.mysema.com/2010/09/querying-with-scala.html) and can not run in my project. Exists any other examples utilization scala+querydsl?



--
Timo Westkämper
Mysema Oy
+358 (0)40 591 2172
www.mysema.com



Giuliano Costa

unread,
Jul 30, 2012, 8:03:25 PM7/30/12
to quer...@googlegroups.com
Hi!


I´m trying the reference link but line

val person = Person as "person"

is not recognized IDE(Intellij) and not compile... :(


Below my code:

trait ID extends Serializable {

  @GeneratedValue (strategy = GenerationType.SEQUENCE)
  @Column (name = "ID")
  @BeanProperty
  var id: Long = _
}

@Entity
@Table(name = "TB_PERSON")
@Model
@SerialVersionUID(13l)
class Person extends ID with Serializable {

  @BeanProperty
  @Column(name = "DS_NAME", nullable = false, length = 100)
  @Index(name = "IDX_PERSON_NAME")
  @NotNull
  @Size(min = 3, max = 100)
  var name:String = _
}


Em domingo, 29 de julho de 2012 15h26min53s UTC-3, Timo Westkämper escreveu:
Hi.

This blog post might be a bit out of date. The reference docs are up to date http://www.querydsl.com/static/querydsl/2.7.0/reference/html/ch02s08.html

Br,
Timo

Timo Westkämper

unread,
Jul 31, 2012, 2:32:32 AM7/31/12
to Querydsl on behalf of Giuliano Costa
Hi.

I will provide you with some instructions later today.

Timo

Giuliano Costa

unread,
Jul 31, 2012, 9:26:16 AM7/31/12
to quer...@googlegroups.com
Thanks Timo!




Att,
Giuliano


Em terça-feira, 31 de julho de 2012 03h32min32s UTC-3, Timo Westkämper escreveu:
Hi.

I will provide you with some instructions later today.

Timo

Timo Westkämper

unread,
Jul 31, 2012, 1:55:15 PM7/31/12
to Querydsl on behalf of Giuliano Costa
Hi.

The following should work for JPA annotated entities

    val exporter = new GenericExporter()
    exporter.setTargetFolder(new java.io.File("target/gen1-jpa"))
    exporter.setSerializerClass(classOf[ScalaEntitySerializer])
    exporter.setTypeMappingsClass(classOf[ScalaTypeMappings])
    exporter.setEmbeddableAnnotation(classOf[Embeddable])
    exporter.setEmbeddedAnnotation(classOf[Embedded])
    exporter.setEntityAnnotation(classOf[Entity])
    exporter.setSkipAnnotation(classOf[Transient])
    exporter.setSupertypeAnnotation(classOf[MappedSuperclass])
    exporter.setCreateScalaSources(true)
    exporter.export(packageToBeExported)

After that you can create variables like this

  val person = QPerson as "person"

I will update the Scala section of the reference docs for the next release.

Br,
TImo
Reply all
Reply to author
Forward
0 new messages