CREATE TABLE "MANTENIMIENTO_MAESTRO"
( "TABLECODE" NUMBER(*,0),
"CODIGO" VARCHAR2(400),
"DESCRIPCION" VARCHAR2(400),
"IDIOMA" VARCHAR2(400),
"ID" VARCHAR2(400),
CONSTRAINT "MANTENIMIENTO_MAESTRO_CON" PRIMARY KEY ("ID") ENABLE,
CONSTRAINT "MANTENIMIENTO_MAESTRO_CON2" FOREIGN KEY ("CODIGO")
REFERENCES "PELAYO_COLORES" ("CODIGO") ENABLE
)
/
- Sequence and trigger for auto incrementing the id column
SEQUENCE:
---------
CREATE SEQUENCE "MANTENIMIENTO_MAESTRO_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999
INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE
TRIGGER:
-------
CREATE OR REPLACE TRIGGER "MANTENIMIENTO_MAESTRO_TRIGGER"
before insert on Mantenimiento_Maestro
for each row
begin
select Mantenimiento_Maestro_seq.nextval into :new.id from dual;
end;
/
CREATE TABLE "PELAYO_COLORES"
( "CODIGO" VARCHAR2(400),
"COLOR" VARCHAR2(40),
"ID" VARCHAR2(400),
CONSTRAINT "PELAYO_COLORES_CON" PRIMARY KEY ("CODIGO") ENABLE,
CONSTRAINT "PELAYO_COLORES_CON_FAN" FOREIGN KEY ("ID")
REFERENCES "MANTENIMIENTO_MAESTRO" ("ID") ENABLE
)
/
2. repository.xml as fallows:
<item-descriptor name="pelayo" sub-type-property="type" version-property="version" expert="true" use-id-for-path="false" folder="false">
<table name="Mantenimiento_Maestro" type="primary" id-column-name="id" >
<property name="type" data-type="enumerated" column-name="tablecode" hidden="true" xml-combine="append">
<attribute name="useCodeForValue" value="false"/>
<option value="colores"/>
<option value="profesiones"/>
<option value="Tiposdesegurosautomoviles"/>
<option value="Companiasaseguradoras"/>
<!--in the same way remaining entidades-->
</property>
</table>
</item-descriptor>
Note:Mantenimiento_Maestro table tablecode column stores different code for each entidades.
The below item descriptor is for one single entidades:(In the same way I developed the remaining 32 item descriptors)
<item-descriptor name="colores" super-type="pelayo" sub-type-value="colores">
<table name="Mantenimiento_Maestro" type="primary" id-column-names="id">
<property name="descripcion" column-name="descripcion" data-type="string" required="false" readable="true" writable="true" queryable="true" hidden="false" expert="false" cache-mode="inherit"/>
<property name="idioma" column-name="idioma" data-type="enumerated" required="false" readable="true" writable="true" queryable="true" hidden="false" expert="false" cache-mode="inherit">
<option value="0" code="spanish"/>
<option value="1" code="english"/>
</property>
</table>
<table name="pelayo_colores" type="auxiliary" id-column-names="id">
<property name="codigo" column-name="codigo" data-type="string" required="false" readable="true" writable="false" queryable="true" hidden="false" expert="false" cache-mode="inherit"/>
<property name="color" column-name="color" data-type="string" required="false" readable="true" writable="true" queryable="true" hidden="false" expert="false" cache-mode="inherit"/>
</table>
</item-descriptor>