What are the major differences between Play Framework 1.0 and 2.0?

Here’s my list, of course, with some duplications breaks backward compatibility (it’s a rewrite from scratch) core programmed in scala vs java (got to learn scala to collaborate) scala for templates (but work is being done on groovy templates as a module, to ease migration), so you have to specify the type of each parameter … Read more

Play 2.x: How to make an AJAX request with a common button

For this job you should go with javascriptRoutes as it generates correct JS paths based on your routes.conf. You’ll find usage sample in Zentask sample Anyway, for now you can fix your AJAX call by changing the url to url : ‘@routes.Application.saveDefaultPhoneForUser()’, This way requires it to place the whole JS in template, which is … Read more

How to write database-agnostic Play application and perform first-time database initialization?

You find an example on how to use the cake pattern / dependency injection to decouple the Slick driver from the database access layer here: https://github.com/slick/slick-examples. How to decouple the Slick driver and test application with FakeApplication A few days ago I wrote a Slick integration library for play, which moves the driver dependency to … Read more

Accessing the application.conf properties from java class with Play! 2.0

Try Play.application().configuration().getString(“your.key”) As noted in the comment (nico_ekito), please use play.Play and not play.api.Play. play.api.Play is for scala controllers (see comment by Marcus biesior Biesioroff) Additionally, play uses https://github.com/typesafehub/config under the hood so it can also provide some insights.

How to handle optional query parameters in Play framework

Encode your optional parameters as Option[String] (or Option[java.util.Date], but you’ll have to implement your own QueryStringBindable[Date]): def birthdays(from: Option[String], to: Option[String]) = Action { // … } And declare the following route: GET /birthday controllers.Application.birthday(from: Option[String], to: Option[String])

NoSuchMethodError in javax.persistence.Table.indexes()[Ljavax/persistence/Index

I’ve ran into the same problem. The question here is that play-java-jpa artifact (javaJpa key in the build.sbt file) depends on a different version of the spec (version 2.0 -> “org.hibernate.javax.persistence” % “hibernate-jpa-2.0-api” % “1.0.1.Final”). When you added hibernate-entitymanager 4.3 this brought the newer spec (2.1) and a different factory provider for the entitymanager. Basically … Read more

scala slick method I can not understand so far

[UPDATE] – added (yet another) explanation on for comprehensions The * method: This returns the default projection – which is how you describe: ‘all the columns (or computed values) I am usually interested’ in. Your table could have several fields; you only need a subset for your default projection. The default projection must match the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)