playframework-2.2

playframework - package javax.persistence does not exist

允我心安 提交于 2019-12-02 01:09:42
问题 I have Issue with using database I was going with this tutorial http://vimeo.com/58969923# (one from playframework.com page) in the model: play-2.2.1/jcirs/app/models/MedicalIncident.java public class MedicalIncident extends Model{} I am trying to use Entity. For that I have to import: javax.persistence.* and play.db.ebean.* but none of them can be found. The error is package javax.persistence does not exist What should I do? Use any other database engine? Or should download some dependency.

playframework - package javax.persistence does not exist

穿精又带淫゛_ 提交于 2019-12-01 21:39:00
I have Issue with using database I was going with this tutorial http://vimeo.com/58969923# (one from playframework.com page) in the model: play-2.2.1/jcirs/app/models/MedicalIncident.java public class MedicalIncident extends Model{} I am trying to use Entity. For that I have to import: javax.persistence.* and play.db.ebean.* but none of them can be found. The error is package javax.persistence does not exist What should I do? Use any other database engine? Or should download some dependency. I would like to go with playframework best way. Please help. My configuration application.conf: db

Asset mapping outside public folder on Play framework

寵の児 提交于 2019-12-01 18:14:33
问题 We have huge list of images that we need to store in an external path.. i.e outside of play application folder. How can we make it available to play as an asset so it streams it as a web server? 回答1: You've probably seen Play's documentation about Assets. Additionally to Play's standard assets you can define your own. In conf/routes you need to add a line for your external asset: # Static resources (not managed by the Play framework) GET /my_external_assets/*file controllers.ExtAssets.at(file

How to persist models entity in playframework submodule using jpa/hibernate

非 Y 不嫁゛ 提交于 2019-12-01 13:14:22
问题 I have project in PLAY FRAMEWORK wich contain few submodules. Each submodule has folder structure like this: app: controllers models views conf: submodulename.routes build.sbt I would like to persist all java class entities in folder: models . How should I configure play framework and/or hibernate entity manager to scan this folders for entities. I have example model class as follow: package models.common; import javax.persistence.CascadeType; import javax.persistence.Column; import javax

Play framework and Java version

霸气de小男生 提交于 2019-12-01 12:58:16
问题 I would like to know if there is any connection between the play framework version (of my java app) to the java version of my app? Example: if I use play 2.2.1 and has java8 on my computer. Can I use java8 stuff in my code? If there is a connection. What is the first play version that works with java8? Thank you Niv 回答1: The Play 2.3.x is first version that mentions Java 8, see here Today morning I was talking with colleague of mine who found running 2.1.x some kind of problematic with Java 8

package names (namespaces) in subproject classes in Play Framework

柔情痞子 提交于 2019-12-01 12:31:44
I am trying to create multi submodule project in PlayFramework (play framework 2.2.1). How should I name package in submodules? F.E. I have structure as follow: app conf doc logs modules: common: app: controllers models views conf: common.routes build.sbt project public target test How package (namespace) I should named in file: /modules/common/app/controllers/Aplication.java Wich one should it be: package controllers; package controllers.common; package common.app.controllers; actually I have like that: package controllers.common; public class Index extends Controller {} The same issue I have

Play 2.2 match if there exists an implicit Json converter

北慕城南 提交于 2019-12-01 08:16:59
I have put all my Json converters in one file JsonUtil, and then have a convertToJson method which tries to convert any object passed to json. Basically a structure like this: implicit val format_A = format[A] implicit val format_B = format[B] def convertToJson(o: Any): JsValue = o match { case a: A => Json.toJson(a) case b: B => Json.toJson(b) case a: Any => Logger.warn("could not convert to json: "+a); JsNull } but with alot more formatters / cases. I don't want to import all these implicits when I need conversions (for various reasons). Is there a way to match if there exists a valid toJson

No Json serializer found for type Seq[(String, String)]. Try to implement an implicit Writes or Format for this type

穿精又带淫゛_ 提交于 2019-12-01 08:12:20
I want to convert a Seq[(String, String)] into JSON with Scala play, but I face this error: No Json serializer found for type Seq[(String, String)]. Try to implement an implicit Writes or Format for this type. How can I fix this? It depends on what you're trying to achieve. Say you have a Seq[(String, String)] like this: val tuples = Seq(("z", "x"), ("v", "b")) If you are trying to serialize it as following: { "z" : "x", "v" : "b" } Then just use Json.toJson(tuples.toMap) . If you'd like to have some custom representation of your tuples you can define a Writes as the compiler suggests:

Play 2.2 match if there exists an implicit Json converter

微笑、不失礼 提交于 2019-12-01 07:41:02
问题 I have put all my Json converters in one file JsonUtil, and then have a convertToJson method which tries to convert any object passed to json. Basically a structure like this: implicit val format_A = format[A] implicit val format_B = format[B] def convertToJson(o: Any): JsValue = o match { case a: A => Json.toJson(a) case b: B => Json.toJson(b) case a: Any => Logger.warn("could not convert to json: "+a); JsNull } but with alot more formatters / cases. I don't want to import all these

Why does sbt report missing libraries for Scala 2.10.2 (since Aug, 1th)?

醉酒当歌 提交于 2019-12-01 05:57:45
I've got a number of Play 2.2.x apps that have been building without problem for months. However, starting on 1 Aug 2014, I started getting the following warnings and errors: Getting org.scala-sbt sbt 0.13.0 ... :: problems summary :: :::: WARNINGS module not found: org.scala-lang#scala-library;2.10.2 ==== local: tried /Users/dpope/.ivy2/local/org.scala-lang/scala-library/2.10.2/ivys/ivy.xml ==== typesafe-ivy-releases: tried repo.typesafe.com/typesafe/ivy-releases/org.scala-lang/scala-library/2.10.2/ivys/ivy.xml ==== Maven Central: tried repo1.maven.org/maven2/org/scala-lang/scala-library/2.10