The following code snippet shows how to retrieve persisted objects.

Java Code:
try {
   tx = pm.currentTransaction();
   tx.begin();
   Extend ex = pm.getExtent(Employee.class, true);
   Iterator i = ex.iterator();
   while(i.hasNext()) {
     Employee obj = (Employee) i.next();
   }
   tx.commit();
} catch (Exception e) {
   if(tx.isActive()) {
      tx.rollback();
   }
}