Session session = HibernateUtil.getSessionFactory().openSession();
MonsterHibernateDAO myDAO = new MonsterHibernateDAO();
myDAO.setSession(session);
Transaction tx = session.beginTransaction();
Monster myMonster = myDAO.getMonsterByShortDesc(mobName);
tx.commit();
if (myMonster == null) {
myHandler.debugInfo("New monster: "+mobName);
tx = session.beginTransaction();
myMonster = new Monster();
myMonster.setShortDescription(mobName);
session.save(myMonster);
tx.commit();
myHandler.debugInfo(".. added to the database with id: "+myMonster.getId());
}
tx = session.beginTransaction();
KilledMonster myKill = new KilledMonster();
myKill.setMonster(myMonster);
myKill.setExpWorth(new Integer(expGained));