assertEquals(id, ((Persistent) results.get(0)).getObjectId());
}
public void testNewObject() throws Exception {
DataContext context = createDataContext();
GeneratedColumnTestEntity idObject = context
.newObject(GeneratedColumnTestEntity.class);
String name = "n_" + System.currentTimeMillis();
idObject.setName(name);
idObject.getObjectContext().commitChanges();
// this will throw an exception if id wasn't generated one way or another
int id = DataObjectUtils.intPKForObject(idObject);
assertTrue(id >= 0);
// make sure that id is the same as id in the DB
context.invalidateObjects(Collections.singleton(idObject));
GeneratedColumnTestEntity object = DataObjectUtils
.objectForPK(context, GeneratedColumnTestEntity.class, id);
assertNotNull(object);
assertEquals(name, object.getName());
}