简体   繁体   中英

How can I get EclipseLink to create MySQL InnoDB tables?

It generates MyISAM tables by default. I don't want to have to get it to generate a DDL script and then edit that if I can avoid it. I would also like to avoid changing the default table type of my MySQL installation unless I can do that for online one database. Any ideas?

Can't see any way other than editing the scripts, or setting the default type in MySQL.

There is a bug logged for this, please vote for it,

https://bugs.eclipse.org/bugs/show_bug.cgi?id=214519

EclipseLink does support creating tables with a postFix such as engine=InnoDB in its TableDefinition setCreationSuffix(), but does not support any way to generate this, and does not provide an event or platform hook for default table generation (which would be very useful).

You could use EclipseLink DefaultTableGenerator yourself to generate your tables yourself in a SessionCustomizer. You would call generateDefaultTableCreator() then loop through its TableDefitions add set the InnoDB suffix, then tell it to create the tables. All of the classes are in the org.eclipse.persistence.tools.schemaframework package.

In EclipseLink 2.4 the:

eclipselink.ddl.default-table-suffix

not work.

In v2.4 you must use:

eclipselink.ddl-generation.table-creation-suffix

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM