From: <leg...@at...> - 2003-10-31 10:28:14
|
Message: The following issue has been closed. Resolver: Gavin King Date: Fri, 31 Oct 2003 4:27 AM Search the forums for two solutions to this problem. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-441 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-441 Summary: Allow dialect specific table options in create table scripts Type: Improvement Status: Closed Priority: Major Resolution: WON'T FIX Project: Hibernate2 Assignee: Reporter: Maarten Coene Created: Fri, 31 Oct 2003 4:24 AM Updated: Fri, 31 Oct 2003 4:27 AM Environment: all Description: Hi, I need support for table_options in the MySQL create table syntax. The MySQL create syntax looks like: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement] I don't know if ohter databases can have table_options in their create scripts. The reason I need this is that I want to create tables using the SchemaExport tool and these tables must have the InnoDB type, this means I have to create SQL commands like: CREATE mytable (...) TYPE=INNODB; I want to solve my problem by creating my own dialect (e.g. InnoDbMySQLDialect extends MySQLDialect) but I didn't find a way to specify these table_options with the current implementation. To allow these table_options, I propose the following mimimal changes to your code: 1. add this method to Dialect.java: public String getTableOptions() { return ""; } 2. change the sqlCreateString(Dialect dialect, Mapping p) method of Table.java (add this to the end of the method): buf.append(StringHelper.CLOSE_PAREN); buf.append(" "); // ADD THIS LINE buf.append(dialect.getTableOptions()); // ADD THIS LINE return buf.toString(); This way, I can easily create my own dialect: public class InnoDbMySQLDialect extends MySQLDialect { public String getTableOptions() { return "TYPE=INNODB"; } } kind regards, Maarten Coene --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |