// cfg.addResource("Item.hbm.xml");
cfg.addClass(Item.class).setProperty("hibernate.dialect",
"org.hibernate.dialect.MySQLInnoDBDialect");
cfg.setProperty("hibernate.hbm2ddl.auto", "update");
cfg.setProperty("show_sql", "true");
SessionFactory factory = cfg.buildSessionFactory();
session = factory.openSession(conn);
} catch (ClassNotFoundException e) {
e.printStackTrace(System.err);
} catch (SQLException e) {
e.printStackTrace(System.err);