EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/em");
String mode = req.getParameter("mode");
if ("Write".equals(mode))
{
TestEntity test = new TestEntity("Hello", "World");
em.persist(test);
}
else
{
TestEntity test = em.find(TestEntity.class, "Hello");
resp.setContentType("text/plain");
PrintWriter out = resp.getWriter();
out.print(test.getDescription());
out.close();
}
}
catch (Exception e)
{