I have the following code:
Code:
Session session = null;
try {
// get factory and open session
SessionFactory factory = HibernateConfiguration.getInstance().getFactory();
session = factory.openSession();
// create rule list
Transaction t = session.beginTransaction();
RuleListBO ruleList = new RuleListBO();
session.save(ruleList);
t.commit();
session.clear();
// delete rule list
t = session.beginTransaction();
Long id = new Long(ruleList.getId().getInternalID());
ruleList = (RuleListBO)session.get(RuleListBO.class, id);
session.delete(ruleList);
List list = session.find(
"select from RuleListBO as rulelist where rulelist.pyramidName = ?",
"Nwind", Hibernate.STRING);
t.rollback();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
try {
if (session != null) {
session.close();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
What I see is that the object gets deleted the minute the session.find method is executed. Not even the rollback reverts the deletion. I'm using mySQL 4.0.16 on windows, JDBC driver version 3.0.9
Am I missing something?
Eyal