public void testArithmFunc() {
EntityManager em = currentEntityManager();
startTx(em);
CompUser user = em.find(CompUser.class, userid1);
assertNotNull(user);
assertEquals("Seetha", user.getName());
assertEquals(36, user.getAge());
String query =
"UPDATE CompUser e SET e.age = ABS(e.age) WHERE e.name='Seetha'";
int num = em.createQuery(query).executeUpdate();
assertNotNull(num);
assertEquals(1, num);
user = em.find(CompUser.class, userid1);
em.refresh(user);
assertEquals(36, user.getAge());
//----------------------ABS Tested
query =
"UPDATE CompUser e SET e.age = SQRT(e.age) WHERE e.name='Seetha'";
num = em.createQuery(query).executeUpdate();
assertNotNull(num);
assertEquals(1, num);
user = em.find(CompUser.class, userid1);
em.refresh(user);
assertEquals(6, user.getAge());
//-------------------------SQRT Tested
query =
"UPDATE CompUser e SET e.age = MOD(e.age, 4) WHERE e.name='Seetha'";
num = em.createQuery(query).executeUpdate();
assertNotNull(num);
assertEquals(1, num);
user = em.find(CompUser.class, userid1);
em.refresh(user);
assertEquals(2, user.getAge());
//-------------------------MOD Tested
query = "SELECT e.name FROM CompUser e WHERE SIZE(e.nicknames) = 6";
List result = em.createQuery(query).getResultList();