From: <leg...@at...> - 2003-10-31 12:40:14
|
The following comment has been added to this issue: Author: Maarten Coene Created: Fri, 31 Oct 2003 6:39 AM Body: thx for the help. just trying to help to improve hibernate... Unfortunately, this last solution would introduce database-specific code in my build.xml file (I'm using the schemaexport ant task to create the tables). I've put a lot of effort to keep the build.xml antfile database independent because we must be able to deploy our application to different systems with different databases very quick and easy without having to modify a lot of files. The only thing that should be changed here is the hibernate configuration file which contains the dialect, driver, database_url, ... Maybe I can use a property file to indicate which SQL delimiter the schemaexport task should use, but that's introducing an extra dependency between that propertyfile and the hibernate configuration file: changing the dialect will also require to change the extra property. Or maybe I can check the value of the dialect property in my build.xml file to see if it's MySQL (yuck, but it will probably work). Anyway, I would prefer a solutions which is easier to maintain ... regards, 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 |