playframework-2.1

play 2.1.1: Unable to rollback transaction with ebean orm

旧时模样 提交于 2019-12-13 05:43:03
问题 I have problem with understanding how to work with ebean transactions under play 2.1.1. Ebean.execute(txScope, new TxRunnable() { public void run() { Ebean.beginTransaction(); System.out.println("[**] : " + Ebean.currentTransaction()); User user = Ebean.find(User.class, 22); user.setPassword("qweqwe125"); Ebean.save(user); user = Ebean.find(User.class, 22); user.setPassword("qweqwe126"); Ebean.rollbackTransaction(); // or other case //Ebean.currentTransaction().rollback(); } But in this case

sbt compile fails due to missing constructor Jedis(java.net.URI) in Jedis 2.1.0

∥☆過路亽.° 提交于 2019-12-13 05:09:25
问题 My simple project has a library dependency on Jedis (the Java Redis library): name := "fit001" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, "redis.clients" % "jedis" % "2.1.0" ) play.Project.playJavaSettings I ran both play update and play dependencies successfully. Here are the resolved dependencies of your application: +-------------------------------------------------------------------+--------------------------------------------------------+----------

Play2 “include” directive override configuration with substitution

爱⌒轻易说出口 提交于 2019-12-13 02:19:11
问题 I have following conf files in my play2.1.0 application application.conf override.dev.conf override.qa.conf override.prod.conf And there is a application.mode property in the application.conf file which will have either one of dev/qa/prod values. application.conf also has a line to include env/mode specific conf files as override. This is what is not working with substitution. Reason: To have the override properties in the env/mode specific conf files. Referred: http://www.playframework.com

How configure aspectj compilation in playframework 2.1.1

吃可爱长大的小学妹 提交于 2019-12-13 01:09:12
问题 I have added to plugins.sbt this declaration addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.0") Now I would like to configure this plugin to compile my java controller classes using aspect library org.springframework:spring-aspects:3.1.4 as with aspectj-maven-plugin I have set this configuration : import sbt._ import Keys._ import play.Project._ import com.typesafe.sbt.SbtAspectj._ import com.typesafe.sbt.SbtAspectj.AspectjKeys._ object ApplicationBuild extends Build { val

How to publish additional artifact with sbt (one-jar)

穿精又带淫゛_ 提交于 2019-12-12 20:55:28
问题 I am new to scala and sbt. I managed to create an executable jar with one-jar plugin. I am trying to publish this additional (one-jar) artifact to artifactory, but I am not able to do that. Does anybody know how to do that? I had a look at http://www.scala-sbt.org/0.12.3/docs/Detailed-Topics/Artifacts.html but I was not able to get it to work. (play 2.1.2, sbt 0.12.3, scala 2.10) 回答1: I added the following to build.sbt and it worked fine. com.github.retronym.SbtOneJar.oneJarSettings artifact

How to get application name and version only on command line in Play 2.1

南笙酒味 提交于 2019-12-12 16:17:28
问题 According to this nice trick I'm setting version and after command play normalized-name version in console get the output like [info] Loading project definition from /www/apps/MyApp/project [info] Set current project to MyApp (in build file:/www/apps/MyApp/) [info] myapp [info] 1.2.3 Anyway for deployment automatization I'd need to get only concated values like myapp-1.2.3 or at least only value myapp and 1.2.3 (without Loading info [info] prefixes) how can I do this? 回答1: I use SBT 0.13 that

how can I remove codes creating session in unit test for Play framework and slick

点点圈 提交于 2019-12-12 15:04:23
问题 I'm using play 2.0 and slick. so I write unit test for models like this. describe("add") { it("questions be save") { Database.forURL("jdbc:h2:mem:test1", driver = "org.h2.Driver") withSession { // given Questions.ddl.create Questions.add(questionFixture) // when val q = Questions.findById(1) // then // assert!!! } } } it works well but following snippets is dupulicated every unit test. Database.forURL("jdbc:h2:mem:test1", driver = "org.h2.Driver") withSession { Questions.ddl.create // test

Using JSON Implicit Reader

蓝咒 提交于 2019-12-12 14:10:41
问题 I have a List[play.api.libs.json.JsObject] returned from a MongoDB with the following document schema: { "web_category_id" : "blah", "web_category_name" : "abcabc", "top_group_id" : "blah", "top_group_name" : "namehere", "sub_web_category" : [ { "name" : "blah", "id" : "idblah" }, { "name" : "another blah", "id" : "another idblah" } ] } I am trying to use an implicit reader to read the data into a WebCategory case class: case class WebCategory(topGroupName: String, topGroupID: String,

IntelliJ Play2 and Scala plugins are not compatible. Makes IntelliJ 12 no longer work as expected

与世无争的帅哥 提交于 2019-12-12 11:17:04
问题 I upgraded my IntelliJ(12.1.4) to the new Play 2.0 Support(0.5.54) plugin and two things happened: IntelliJ no longer recompiles my .scala classes, this meaning that if I e.g change the signature of a method from def something(s1: String) = {} to def something(s1: String, s2: String) = {} I get an error that ) is expected after the first param. I run the app from the terminal with play debug ~run and there the app recompiles without a problem. The scala.html are not evaluated properly and I

How to create sub projects in Play Framework? (play#play-java_2.9.2;2.1-RC3: not found)

我的梦境 提交于 2019-12-12 07:52:46
问题 I want to test how sub projects work, especially how the routes of the sub project are taken into account in main project (this was not visible before). I have read the docs here: https://github.com/playframework/Play20/wiki/SBTSubProjects What have I done: (after downloading play 2.1 RC3) Create new Java Project: play new MainProject Create new folder inside MainProject: modules Create new Java Project: play new SubProject On both projects: play eclipse since play eclipsify does not work