I have a project for school and I have to use Java. Recently I found play framework and I want to try to use it. It's easy enough for a quick start, but I ran into a problem with session.
Being stateless by its nature, play sends entire session to user in cookie and receives it on next request, so it allows only limited amount of data in session.
What I want to do is to fetch User object from DB on user login, and keep it in session, so I could access it from templates and so on (I have some methods in User class that I need to call in order to customize UI), but if I put User object, play calls its toString method and puts that in session.
I found that recommended way is to put larger amount of data into Cache, but I don't know how to access it from template (I guess I could make method with @Before annotation and add user to renderArgs, but that does not seem very clean to me). Another problem is that Cache has limited lifetime, so my object can disappear.
Does anyone has experience with this kind of problems?
Is there any way to use server side session with play? I don't need REST functionality for this project, so, as far as I am concerned, application can save state...