|
Re: Generate index for foreign keys in oracle [message #825210 is a reply to message #820806] |
Tue, 20 March 2012 15:58 |
|
I don't think you can do this without extending EclipseLink.
I think a mechanism to allow the platform, or user events to customize table generation would be useful, so please log a bug, and consider adding a patch if you are willing to.
You could just use your own table creation scripts to create your indexes, or use the @Index annotation in EclipseLink to index the foreign keys.
James : Wiki : Book : Blog : Twitter
|
|
|
|
|
Re: Generate index for foreign keys in oracle [message #849837 is a reply to message #848445] |
Thu, 19 April 2012 13:47 |
|
Looks good, except for,
> if (!primKeyList.contains(foreignKey.getName())) {
The name of the foreign key is not the column name, but the constraint name. To do what you want you would need to check if any (or all) of the foreign key fields are in the primary key list.
Also, I would make the shouldCreateIndicesForForeignKeys a variable, as I don't think this is database specific, but application specific. Databases don't create indexes on foreign keys automatically as you do not normally query on foreign keys, foreign keys are use to query primary keys, which are indexed. Foreign keys however are still commonly queried in most applications, both for OneToMany as well as ManyToMany, which is why you see the performance boost. It might even be a good idea to make your new option true by default, and allow a persistence unit property "eclipselink.ddl-generation.index-foreign-keys" to disable it.
James : Wiki : Book : Blog : Twitter
|
|
|
|
Powered by
FUDForum. Page generated in 0.03797 seconds