i develop a little playframework project and use jpa in a inner block like this:
private void sendMailToTheRegulator(final Machine mc, String rea) {
List<LogProject> pros = null;
try {
pros = JPA.withTransaction(new Function0<List<LogProject>>() {
@Override
public List<LogProject> apply() throws Throwable {
List<ServerModel> ss = JPA.em()
.createQuery("from ServerModel where machineId=")
.setParameter(1, mc.getId()).getResultList();
...
}
the mc does not exist in apply() so i cannot access its id. when i execute the codes it throws that the mc.getId() is null.
what should i do to fix it?