Context enc = (Context) ctx.lookup("java:comp/env");
EntityHome home = (EntityHome) enc.lookup("ejb/Entity");
try
{
//Remove old entity beans from previous test runs
Entity existing = home.findByPrimaryKey(new EntityPK(12345));
if(existing != null)
{
existing.remove();
}
}
catch(Exception e)
{
//ignore
}
Entity bean = home.create(12345, 6789);
bean.write(7890);
bean.read();
bean.remove();
}
catch(Exception e)
{
throw new ServletException("Failed to call Entity through remote interfaces", e);
}