I am in the process of rewriting the play-authenticate-usage application from ebean to jpa hibernate.
The thing I got stuck with is that in the Global.java class of the app there is a preload of data for the security role. Because you can not get a JPA entitymanager in the Global.java context I need to do this in another way.
In unit test I use the fakeApplication stuff like:
running(fakeApplication(), new Runnable() {
public void run() {
JPA.withTransaction(new play.libs.F.Callback0() {
public void invoke() {
JPA stuff.
};
});
}
});
}
I am not sure if this is the right way to go. What I really would like is using yaml to preload the database. Does anybody know how to dothis? In my final application I need to preload much more data then just the security_role 'user'.
Thanks in advance.