ODMG odmg = null;
try {
/* Get the implementation */
Implementation impl = null;
try {
odmg = (ODMG) manager.lookup(ODMG.ROLE);
impl = odmg.getInstance("personnel");
} catch (ComponentException cme) {
getLogger().error("Could not look up the ODMG Implementation", cme);
} catch (ODMGException oe) {
getLogger().error("Failed to instantiate ODMG Implementation", oe);
}
Department bean = new Department();
bean.setId(6);
bean.setName("ODMG Development");
Transaction tx = impl.newTransaction();
tx.begin();
tx.lock(bean, Transaction.WRITE);;
tx.commit();
Inserted data: bean.getId() + " : " + bean.getName()
} finally {
manager.release(odmg);
}