From: <leg...@at...> - 2003-10-31 10:41:14
|
The following comment has been added to this issue: Author: Maarten Coene Created: Fri, 31 Oct 2003 4:40 AM Body: I did search the forum and none of the 2 solutions is a good one: 1. http://forum.hibernate.org/old//809065.html The first solutions tells met to use the --default-table-type=InnoDB setting of the MySQL database which is not possible in my case. 2. http://forum.hibernate.org/old//856390.html The second solution is similar to my solution and also requires modifications to the hibernate sources. But I think my solution is better because you don't have to check if the specific Dialect is an instance of the MySQL4Dialect. (In my case this would mean that the hibernate sources would have a dependency to my custom dialect and this is something you don't want to) I just want a solution for this problem where I don't have to patch the hibernate sources and can use the official hibernate releases. Maarten Coene --------------------------------------------------------------------- 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 |