|Re: [eclipselink-dev] adding support for creation of column indices|
This is what I would try:Add createIndices, dropIndices, replaceIndices methods to TableCreator, which forward calls to SchemaManager (similar as done for constraints and tables). These again forward to TableDefinition, which can generate the CREATE INDEX statements based on what's in uniqueKeys (or obtained from getFields() like getPrimaryKeyFieldNames() does).
Add invocations to TableCreator#create/drop/replaceIndices from TableCreator#create/drop/replaceTables (at the end, after processing the sequences when creating, at the start when dropping).
In the TableDefinition's methods I can check whether this platform actually requires the indices created/dropped (as is done for constraints).
Would that be the best way? Thanks, Dies Koper Dies Koper wrote:
Hi Tom, all, As I mentioned in my previous e-mail, I'm trying to run the foundation/eclipselink.core.test JUnit tests on the Symfoware platform. Most of them currently fail. Some are issues with restrictions in Symfoware DB (like you cannot use a reserved keyword as column name (e.g. "LANGUAGE")), a few others I need to look at in more detail. But most are failing because Symfoware DB needs you to create an index for tables with a unique constraint. That means that for any auto-generated table with a PRIMARY KEY, I currently get an error when performing a CRUD on the table. When we created the Symfoware platform class I didn't see this as a major restriction, I assumed in production systems people would be creating their own DDL scripts with tuning parameters and indices etc.). But as the unit tests would be a great base for regression testing for the Symfoware platform, I'm trying to think of a way to get it working anyway. I'd like to explore the possibility of having EclipseLink create the required indices when creating tables. So for each create table statement such as the following, I need a create index statement such as the one below: CREATE TABLE EJB.CUSTOMER ( ID VARCHAR(128) NOT NULL , NAME VARCHAR(128) NOT NULL , AGE VARCHAR(128) , PRIMARY KEY (ID,NAME) ); CREATE INDEX EJB.CUSTOMER.IDX1 KEY(ID,NAME); Is there a particular suitable place in the code where to do this, where I can obtain a list of tables that are to be created (or just after the generation of each table DDL) and retrieve which columns have unique/primary constraints, so I can hook in a platform specific callback method to insert the index creation DDL for Symfoware so that the existing code automatically sends it to the DB and/or file? Or is there already such a functionality in EclipseLink that I just need to enable? Thanks! Dies Koper
Back to the top