简体   繁体   中英

Intershop 7.10 Code generator alternate keys generation - NONUNIQUE

We have noticed in Intershop DB that since of migration from 7.9 to 7.10 version, indexes for alternate keys are not generated as UNIQUE INDEX. That is causing all tables that contain alternate keys (system and custom objects) to be generated with NONUNIQUE indexes in the database. For example:

系统表CATALOGCATEGORYLINK

Also, the .ddl file code generated (CatalogCategoryLinkPO.dbindex.oracle.ddl):

/*
 =============================================================================
 File: CatalogCategoryLinkPO.dbindex.oracle.ddl
 Generated by JGen Code Generator from INTERSHOP Communications AG.
 =============================================================================
 The JGen Code Generator software is the property of INTERSHOP Communications AG. 
 Any rights to use are granted under the license agreement. 
 =============================================================================
 */

SET ECHO ON

SET SERVEROUTPUT ON SIZE 1000000

VARIABLE table_space      VARCHAR2(50)
VARIABLE recreate_indexes NUMBER;

EXEC :table_space := '&index_tablespace';
EXEC :recreate_indexes := '&recreate_indexes';

PROMPT /* Class com.intershop.beehive.xcs.internal.catalog.CatalogCategoryLinkPO */
PROMPT -- Foreign key indices
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_FK999', 'CATALOGCATEGORYLINK', '(TARGETCATEGORYID)', :table_space, 'NONUNIQUE', :recreate_indexes);
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_FK998', 'CATALOGCATEGORYLINK', '(SOURCECATEGORYID)', :table_space, 'NONUNIQUE', :recreate_indexes);


PROMPT -- Foreign key indices (dependencies)
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_FK997', 'CATALOGCATEGORYLINK', '(DOMAINID)', :table_space, 'NONUNIQUE', :recreate_indexes);


PROMPT -- Inversion Entry key indices
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_IE001', 'CATALOGCATEGORYLINK', '(TYPECODE)', :table_space, 'NONUNIQUE', :recreate_indexes);
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_IE002', 'CATALOGCATEGORYLINK', '(SOURCECATEGORYID,TARGETCATEGORYID,DOMAINID,TYPECODE)', :table_space, 'UNIQUE', :recreate_indexes);


PROMPT -- Searchable attribute indices
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_IE999', 'CATALOGCATEGORYLINK', '(DOMAINID)', :table_space, 'NONUNIQUE', :recreate_indexes);


EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_AK001', 'CATALOGCATEGORYLINK', '(SOURCECATEGORYID,TARGETCATEGORYID,DOMAINID,TYPECODE)', :table_space, 'NONUNIQUE', :recreate_indexes);

PROMPT /* Class com.intershop.beehive.xcs.internal.catalog.CatalogCategoryLinkPOAttributeValue */
PROMPT -- Foreign key indices
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_AV_FK002', 'CATALOGCATEGORYLINK_AV', '(ownerID)', :table_space, 'NONUNIQUE', :recreate_indexes);

PROMPT -- Inversion Entry key indices
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_AV_IE002', 'CATALOGCATEGORYLINK_AV', '(intValue)', :table_space, 'NONUNIQUE', :recreate_indexes);
EXEC staging_ddl.create_index('CATALOGCATEGORYLINK_AV_IE003', 'CATALOGCATEGORYLINK_AV', '(doubleValue)', :table_space, 'NONUNIQUE', :recreate_indexes);

Same thing happens when we try to create alternate key for our own custom implemented objects. For example, this is the .edl code snippet:

orm class A1PromotionBenefitPO extends PersistentObjectPO implements A1PromotionBenefit table "A1PromotionBenefit"
    {
        /**
         * Declare alternate key.
         */
        alternate key (promotionUUID, tariffUUID, contractType, contractBinding, domainID);

        /**
         * Holds link to tariff.
         */
        attribute tariffUUID : uuid required searchable;

        /**
         * Holds link to promotion.
         */
        attribute promotionUUID: uuid required;
....
...

And this is the generated .ddl file (A1PromotionBenefitPO.dbindex.oracle.ddl):

/*
 =============================================================================
 File: A1PromotionBenefitPO.dbindex.oracle.ddl
 Generated by JGen Code Generator from INTERSHOP Communications AG.
 =============================================================================
 The JGen Code Generator software is the property of INTERSHOP Communications AG. 
 Any rights to use are granted under the license agreement. 
 =============================================================================
 */

SET ECHO ON

SET SERVEROUTPUT ON SIZE 1000000

VARIABLE table_space      VARCHAR2(50)
VARIABLE recreate_indexes NUMBER;

EXEC :table_space := '&index_tablespace';
EXEC :recreate_indexes := '&recreate_indexes';

PROMPT /* Class hr.a1.orm.promotion.internal.A1PromotionBenefitPO */
PROMPT -- Foreign key indices
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_FK999', 'A1PROMOTIONBENEFIT', '(DISCOUNTUUID)', :table_space, 'NONUNIQUE', :recreate_indexes);
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_FK998', 'A1PROMOTIONBENEFIT', '(PROMOTIONUUID)', :table_space, 'NONUNIQUE', :recreate_indexes);


PROMPT -- Foreign key indices (dependencies)
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_FK997', 'A1PROMOTIONBENEFIT', '(DOMAINID)', :table_space, 'NONUNIQUE', :recreate_indexes);
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_FK996', 'A1PROMOTIONBENEFIT', '(TARIFFUUID)', :table_space, 'NONUNIQUE', :recreate_indexes);


PROMPT -- Inversion Entry key indices
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_IE001', 'A1PROMOTIONBENEFIT', '(PROMOTIONUUID,TARIFFUUID,CONTRACTTYPE,CONTRACTBINDING,DOMAINID)', :table_space, 'UNIQUE', :recreate_indexes);


PROMPT -- Searchable attribute indices
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_IE999', 'A1PROMOTIONBENEFIT', '(DOMAINID)', :table_space, 'NONUNIQUE', :recreate_indexes);
EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_IE998', 'A1PROMOTIONBENEFIT', '(TARIFFUUID)', :table_space, 'NONUNIQUE', :recreate_indexes);


EXEC staging_ddl.create_index('A1PROMOTIONBENEFIT_AK001', 'A1PROMOTIONBENEFIT', '(PROMOTIONUUID,TARIFFUUID,CONTRACTTYPE,CONTRACTBINDING,DOMAINID)', :table_space, 'NONUNIQUE', :recreate_indexes);

As you can see, the alternate key index A1PROMOTIONBENEFIT_AK001 is generated as NONUNIQUE.

Do you know why this is happening? Our code is dependent on alternate keys so we would not like to remove alternate keys from our orm model alltogether.

This really seems to be a bug introduced with 7.10. You should file a bug report with Intershop Support.

As a workaround you can change the generated DDL file of course. Not sure if you eventually can change the ORMDDL.xpt which is used as template to generate those DDL files.

I've created a bug internally, please refer to issue IS-26076 when you file a bug report to Intershop support. Via support you'll get a status update.

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