Configuring QueryDSL in the Play 2 Framework

I am trying to configure QueryDSL in the Play Framework (with Java), but to no avail. I searched for similar issues on Google, and here is what I found:

1. QueryDSL and Play . But this post establishing equivalence with Lombok and the solution does not work for me.

2. Emulation of the MAVEN process . This is what I really need to apply to other similar modules, but does not show an example of how.

3. Configure multiple modules . In this case, it includes several modules and is a bit confusing.

So how can I configure QueryDSL in Play? Can anyone include an example of how to do this?

Thanks in advance.

+4
source share
1 answer

I just started using play-querydsl with Play 2.2.2. I followed the instructions (using 0.1.1 as the version number in plugins.sbt instead of 0.1.0) and it generated the Q * model classes before target/scala-2.10/src_managed/main/querydsl. I use Eclipse, so I ran play eclipseto include this folder in the classpath.

I tried to get the APT annotation compilation to work directly in Eclipse, but refused it.

QueryDSL EasyCriteria, EasyCriteria , Ebean. , , QueryDSL , API JPA.

plugins.sbt( 2.2.2):

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")

addSbtPlugin("com.code-troopers.play" % "play-querydsl" % "0.1.1")

build.sbt( 2.2.2):

name := "project"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  javaJdbc,
  javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"),
  cache,
  filters,
  "org.hibernate" % "hibernate-entitymanager" % "4.3.5.Final",
  "com.mysema.querydsl" % "querydsl-jpa" % "3.3.4",
  "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
  "org.mindrot" % "jbcrypt" % "0.3m",
  "net.sf.opencsv" % "opencsv" % "2.3"
)     

play.Project.playJavaSettings

playJavaSettings ++ QueryDSLPlugin.queryDSLSettings

val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)

QueryDSLPlugin.queryDSLPackage := "models"

play.Keys.lessEntryPoints <<= baseDirectory { base =>
   (base / "app" / "assets" / "stylesheets" * "*.less")
}
+4

Source: https://habr.com/ru/post/1535010/


All Articles