-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Storage Engine Transaction Question
PostPosted: Wed Aug 04, 2004 9:01 pm 
Newbie

Joined: Tue Aug 03, 2004 1:27 am
Posts: 10
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 04, 2004 11:11 pm 
Newbie

Joined: Tue Aug 03, 2004 1:27 am
Posts: 10
At least I think MySQL 4.0.2d uses MyISAM as the default. Please correct me if I'm wrong. My above question still applies though and I would appreciate an answer very much.

Thank you,
Kenneth Louie


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 04, 2004 11:34 pm 
Newbie

Joined: Wed Aug 04, 2004 11:07 pm
Posts: 1
I am a beginner.

could you tell me the difference among the storage engines of MYSQL.

Thanks
,hehe


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 12:01 am 
Newbie

Joined: Tue Aug 03, 2004 1:27 am
Posts: 10
Not sure myself. I think like different storage engines store different things. So would use different amounts of memory. Like storage engines are like table types. I am a beginner too, heh and all I read was that MyISAM doesn't do transactions but InnoDB does. I was wondering if the default was MyISAM and it doesn't support transactions, then why did my code work? Maybe the default isn't MyISAM? And also how would I change the storage engine to InnoDB, and if this involved just MySQL or do I have to modify my servlet or the xml files.

Thank you,
Kenneth Louie


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 6:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can still do transaction demarcation, it just won't have any effect when using MyISAM tables. Try to do a rollback for example and you'll see.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 2:09 pm 
Newbie

Joined: Tue Aug 03, 2004 1:27 am
Posts: 10
So to change my table to InnoDB instead of MyISAM all it takes is MySQL code right? So when I create my table in MySQL I just need to specify what storage engnine I want right? I don't need to specify anything special in my servlet code or my server.xml or hibernate.cfg.xml or cat.hbm.xml to use the InnoDB storage engine right? I would appreciate any help.

Thank you,
Kenneth Louie


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 2:12 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No.

P.S. If you need this kind of handholding, consider reading Hibernate in Action.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.