Root cause :- I was trying to access an Entity object from Play framework Controller.
Solution :
First I tried to annotate the method that calls the JPA object with
Solution :
First I tried to annotate the method that calls the JPA object with
@play.db.jpa.Transactional
But It did n't help, finally i got the issue resolved by using the following piece of code.
private static void populateList (String company, String uid) {
final String dbName = company;
final String Uid = uid;
try {
JPA.withTransaction(company, true,
new play.libs.F.Function0() {
@Override
public Void apply() throws Throwable {
List bhaList = BHA.findByUidWell(dbName, Uid);
System.out.println(bhaList.size());
return null;
}
});
} catch (Throwable throwable) {
Logger.error("Error: ", throwable);
}
}
Hope this helps :)
No comments:
Post a Comment