Mapping Question - Key Order & Database Type

View: New views
2 Messages — Rating Filter:   Alert me  

Mapping Question - Key Order & Database Type

by RogerV :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

When generating a Primary Key from an Enity definition that contains an @EmbeddedId class, how does EclipseLink decide which order to define the key fields in the database - it's not definition order? Can I control the order so that I can make the primary key efficient?

When generating tables for MySQL is there additional config that I can use to define the table type, it apears to be defaulting to MyISAM and I need InnoDB

Regards

Re: Mapping Question - Key Order & Database Type

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using orm.xml may give more control of the order than annotations.  You could also use a DescriptorCustomizer to change the order of the mappings or primary key fields.

You may also consider using your own scripts to create your database, if you need low-level control to add in your own optimizations.

For InnoDB, you can set this in your database as the default, ("default-table-type=innodb" in your MySQL config file).

There is no option in EclipseLink for setting the table type, perhaps log a bug/enhancement for this.

The TableDefinition in the EclipseLink schemaframework used to create the tables does have an API setCreationSuffix() that could be used to set the table type, but you would need to use the DefaultTableGenerator direct to have control to set this.


RogerV wrote:
Hi

When generating a Primary Key from an Enity definition that contains an @EmbeddedId class, how does EclipseLink decide which order to define the key fields in the database - it's not definition order? Can I control the order so that I can make the primary key efficient?

When generating tables for MySQL is there additional config that I can use to define the table type, it apears to be defaulting to MyISAM and I need InnoDB

Regards