catch (KunderaException e)
{
Assert.fail();
}
MongoGeneratedIdStrategyAuto strategyAuto = new MongoGeneratedIdStrategyAuto();
strategyAuto.setName("kuldeep");
try
{
em.persist(strategyAuto);
em.clear();
List<MongoGeneratedIdStrategyAuto> list = em.createQuery("Select c from MongoGeneratedIdStrategyAuto c")
.getResultList();
Assert.assertNotNull(list);
Assert.assertEquals(1, list.size());
Assert.assertTrue(list.get(0).getId() instanceof ObjectId);
Assert.assertEquals("kuldeep", list.get(0).getName());
Object id = list.get(0).getId();
em.clear();
strategyAuto = em.find(MongoGeneratedIdStrategyAuto.class, id);
Assert.assertNotNull(strategyAuto);
Assert.assertEquals("kuldeep", strategyAuto.getName());
}
catch (KunderaException e)
{
Assert.fail();
}