playframework

Web Frameworks: How is Play different from Spring MVC?

The Play Framework offers the following quick overview, but with the exception of the Groovy template engine (which you can get in Spring MVC if you want), Spring seems to offer all the same features and more... Fix the bug and hit reload! Edit your Java files, save, refresh your browser and see the results immediately! No need to comp...

EC2 connection to RDS using Play framework

I have a small site I built using the Play framework that I'm trying to run on an EC2 server against an Amazon RDS instance. I can run the app on my machine against the RDS instance and everything works fine. But when I deploy it to my EC2 server it gets this error: The last packet successfully received from the server was 1,282,977,73...

Getting related object's ID without fetching it from the database (Play framework)

Say I have these two models: public class City extends Model { @ManyToOne private Country country; } public class Country extends Model { } I have a City object and want to know the related Country's ID. I could fetch from the database by doing city.getCountry().getId() but that seems very wasteful. How can I just get the ID ...

object session in playframework

How I can store an instance object foreach user session? I have a class to modeling a complex algorithm. This algorithm is designed to run step-by-step. I need to instantiate objects of this class for each user. Each user should be able to advance step by step their instance. ...

Should I use Play or Lift for doing web development in Scala?

I'm stuck on whether I should focus on Play or Lift for doing web development in Scala. Play looks very polished. The Scala-specific tutorial looks amazing. Furthermore, since I've been coding in MVC frameworks for a long time, it looks super familiar. However, it doesn't look like it can easily accomplish all the brilliant things th...

Howto write custom checks/validation for the play-framework

I try to write checks for the play-framework and see two different possibilities. I described both and want to know if my understanding is correct (So it's more a tutorial than a question, specially because I didn't get any response that I missed something). So what possibilities exists. The simple way: Extending the class Check: Advan...

javax.persistence/hibernate inside play

Hi, I'm new to both hibernate and java, I'm trying to define a simple user->groups->permissions model in playframework, I want the on delete cascade rule enforced at database level and I don't want the orm care about cascade (something similar to python-sqlalchemy passive deletes), here are my models: User model: @Entity @Table(name="...

Play Framework renderJSON Issue

I'm new to Play Framework, and having trouble rendering a JSON object. public static void LoginFail() { Object[][] statusArray = { {"Status", "401"}, {"Message", "Unauthorized"}, {"Detail", "No API Key Supplied"} }; renderJSON(statusArray); } This only displays "[[{},{}],[{},{}],[{},{}]]"...what am I doing...

How can I create PDFs with Play Framework and Google App Engine?

I need to create PDFs with Play Framework and Google App Engine. Does anyone know how? ...

binding multiple values in hibernate using play framework

I am trying to build query in Play framework, I have select * from Candidate c where (:schools member of c.schools) After I bind :school with List with one element it returns result, but if I bind List with multiple elements nothing happens. Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: {vector} [select...

File upload in playframework with different browers

I'm using playframework to build a web site. And I also use a rich editor named xheditor. Xheditor support ajax-fileuploading, it needs the server side has a action which accepts "filedata" parameter which contains the upload file. So I wrote a upload action: public class Application extends Controller { public static void upload(...

How can I influence the redirect behavior in a play-controller?

In play you always follow the Redirect-After-Post-Pattern if you call from a public-method of a controller. This is in most cases a good behavior, but sometime it could be nasty. So I tried to find out how it works in play 1.1!: The basic is some byte-code-enhancement, which is done in play.classloading.enhancers.ControllersEnhancer. Th...

Egit ignores files from playframework

Today I started to play around with git to create some patches. I choose egit for this job, because I don't know a nice gui for git and I'm a eclipse user. I created a branch and I changed the following files (result of git status) modified: .gitignore modified: framework/src/play/utils/Java.java modified: modules/crud/ap...

Frameworks comparation: Lift, Play and Wicket

What are the advantages and dis­advantages of frameworks Lift, Play and Wicket? What characteristics are best or only supported by each? Thanks ...

How can I do paging with @OneToMany collections

Suppose I have a Post entity and a Comment entity and a one to many relationship: @Entity class Post { ... @OneToMany List<Comment> comments; ... } How can I achieve paging like this: Post post = //Find the post. return post.getComments().fetch(100, 10); // Find the 11th page (page size 10); Is it possible to emulat...

Which documentation you recommend for JPA and other playframework ecosystem

What documentation (books or online resources) you would recommend for a JPA newbie, which want to program with the play framework? In play you only use annotations and hibernate as JPA implementation, so it would be useful if there would be the focus on. I started with wiki-book, but not sure if it is the best solution. A book for gr...

When is it beneficial to have multiple Play applications instead of one monolithic one?

I've settled on the Play framework for the rewrite of our intranet portal. Our portal contains a lot of loosely related stuff so I'm looking for advice on if or how to break it into multiple Play applications. What are the consequences of making it multiple applications? Is single sign-on still possible? How is access control affecte...

New object with HQL

Trying to create an object from an HQL query, but just can't figure out what i'm doing wrong. Query: String query = "SELECT product.code, SUM(product.price), COUNT(product.code) from Product AS product GROUP BY product.code" (or should I use new MyCustomList(product.code, SUM(... , even though it's not mapped?) Now I want to cast thi...

Play framework weblogic 10.3.3.0 deployment

I built a Play app and tried to deploy on weblogic using the following commands: play war -o myApp myApp Later I just deployed the exploded war directory to weblogic, everything worked fine but everytime I try to access a route. I get the following error: Not found GET /myApp/params This is a rest service not an application with U...

How do Play controllers inject variables with the proper name into templates?

In the Play getting started docs, they show this controller: public static void index() { Post frontPost = Post.find("order by postedAt desc").first(); List<Post> olderPosts = Post.find("order by postedAt desc").from(1).fetch(10); render(frontPost, olderPosts); } Then, in the template the frontPost and olderPosts are used withou...