Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Hibernate with MySQL-forced to choose between InnoDB and MyISAM?

 
Anonmo Larry
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded a fresh Hibernate and unzipped it.
In hibernate-3.1/etc/hibernate.properties, we have:


It looks like I have to choose between InnoDB and MyISAM. What if some of my tables are InnoDB and some MyISAM?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use two session factories. Or you could just try picking one dialiect and see if it works. I would imagine that the only differences in SQL would be if you let Hibernate generate DDL (but I'm no MySQL expert, so it might not work).

However, I don't see why you would use the MyISAM database engine anyway, since it doesn't support transactions or foreign key constraints.
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Paul says there are good reasons NOT to use MyISAM tables. The only real reason would be to get a performance boost where high speed is essential and you're not concerned about transactions or referential integrity provided by foreign key constraints. Such cases should be quite rare.

From the MySql manual:

When using the MyISAM storage engine, MySQL uses extremely fast table locking that allows multiple
readers or a single writer. The biggest problem with this storage engine occurs when you have a steady
stream of mixed updates and slow selects on a single table. If this is a problem for certain tables, you can
use another storage engine for them.


There is a good section in the manual on optimizing performance. Using MyIsam instead of InnoDB should generally be a choice of last resort.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic