-->
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.  [ 4 posts ] 
Author Message
 Post subject: [ hbm2ddl.SchemaExport ] adding table options to CREATEs
PostPosted: Mon Mar 15, 2004 2:48 am 
Beginner
Beginner

Joined: Wed Mar 03, 2004 6:02 am
Posts: 46
Location: Kuala Lumpur, Malaysia
Vital stats: Hibernate 2.1.2, MySQL 4.0.18-Max

I would like like to use InnoDB storage for all my tables.
How can I customize the generated CREATE TABLE script to add InnoDB option.

e.g.
Code:
CREATE TABLE foo(
...
) TYPE=InnoDB;


How can I achieve this ?

Regards,

Alistair


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 12:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Read the FAQs. This has been asked many time before.
http://hibernate.bluemars.net/119.html


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 23, 2004 2:58 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 10:09 am
Posts: 26
david wrote:
Read the FAQs. This has been asked many time before.
http://hibernate.bluemars.net/119.html


It might be asked many times before, and I checked the document you recommended. Unfortunately it did append "type=INNODB" after the CREATE statement, but if you look into all the scripts, it appends "type=INNODB" to all statements including "DROP ....".
Although you see the " type=INNODB" appended, you will got surprised that INNODB not generated. It is because only .ddl file you can see the "type=INNODB", but in its real execution, it doesn't append this keyword, so it doesn't work.

I check into the SchemaExport source and revised it to make sure it real executes INNODB table creation. It is just a temporarily revision, I believe you will have better solution.

Here is my revision, please take a look to
Code:
private void execute(boolean script, boolean export, boolean justDrop, boolean format) {
}

In the line 56 of this method, or line 151 of the whole class, you will see
Code:
if (export) statement.executeUpdate( createSQL[j] );

please revise it to
Code:
if (export) {
                     if (createSQL[j].trim().startsWith("create"))
                        statement.executeUpdate( createSQL[j] + " type=InnoDB");
                     else
                        statement.executeUpdate( createSQL[j]);
                  }


Maybe it is not a pretty implementation, at least it does work to generate INNODB table.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 11:34 am 
Newbie

Joined: Wed Sep 14, 2005 11:31 am
Posts: 1
Location: Kiev
use other dialect: MySQLInnoDBDialect

_________________
King Oleg


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.