I have the following code:
Color color = new Color(null,"B12",null,1);
Session session=sessionFactory.openSession();
session.setFlushMode(FlushMode.MANUAL);
session.beginTransaction();
session.save(color);
session.clear();
session.getTransaction().commit();
session.close();
sessionFactory.close();
Documentation says about method Session#clear
the following:
Evict all loaded instances and cancel all pending saves, updates and deletions.
Why doesn't it cancel save()
and still stores data to database? Please help me with it!