I read somewhere that in MySQL the default storage engine is MyISAM. I heard that MyISAM does not support transactions. However, when I used my servlet that had the code for Transactions in the Quickstart like:
try {
Session session = HibernateUtil.currentSession();
Transaction tx= session.beginTransaction();
Cat princess = new Cat();
princess.setName("Princess");
princess.setSex('F');
princess.setWeight(7.4f);
session.save(princess);
tx.commit();
HibernateUtil.closeSession();
}
So was this a fluke my servlet worked, like I might have done something I did not know I did to make it work? If so, do I need code in my servlet to specify like that I should use the InnoDB storage engine? To change storage engines is all I need to do is to put ALTER Table in my mysql command lines, and I don't have to use any java code in my servlet right? I would appreciate help also in saying how I would go about changing the storage engine.
Thank you,
Kenneth Louie
|