PlayFramework 2.x support

PlayFramework 2.x support

This project source code is available on github at https://github.com/deanhiller/playorm.

PlayOrm now includes support for playframework 2.1 in similar way as it supported playframework 1.2.x

The properties you need for in-memory version in your application.conf file are the following:


You can use cassandra by simply removing the nosql.nosqltype=inmemory and removing all the # above and it will work with cassandra.

Enabling the plugin

To enable the plugin:
1. Build the project using ‘gradlew build’.
2. Make sure the above properties are added in your application.conf
3. Your playorm.jar should be in project/lib folder
4. Also, copy src/resources/play2plugin/plugin2.1.jar to your project/lib directory
5. In your project/conf directory add a file called play.plugins with the following content


6. Please note that this is supported for Play 2.10. If you are using Play 2.0.x, then upgrade it to Play 2.10 else open an issue to get an old plugin
7. Playorm.jar comes with a default plugin for Play1.0. So it has a dependency on Play1.2.5.jar. Please make sure that you remove that jar related to Play1.x from your classpath or project’s ‘lib’ folder otherwise it will cause issues
8. Scala users must add “javaCore” to appDependencies
9. You may also want to add “com.alvazan” % “playorm” % “1.5″ to appDependencies to download all the playorm’s dependency else copy all the jar from output/jardist/*.jar to your project/lib folder

Disabling the plugin
Enter following line into application.conf


Use the plugin

1. Import “com.alvazan.play.NoSql” class in your code and use the static method em() to get the NoSqlEntityManager. i.e, just use NoSql.em() to get the NoSqlEntityManager. You don’t need to instantiate ManagerFactory etc as the plugin does it for you.
2. Do remember to add a blank nosql.Persistence.java class in the same jar(or folder structure) where you have your model classes.
3. You can use different configurations for development, QA and production by adding below properties.  (Change mode to qa or prod).


Example project

If you are facing some issues, you can see an example given at https://github.com/easility/play2pluginexample which shows the plugin’s usage with Play2.1.0.

You can use our in-memory database for development and use either Cassandra or Mongodb for Production.

<< Back to Documentation Index