Hi, I have a problem with hibernate version 3.1.3, I have four classes that must have a relation like that:
public class NegociacaoTarifa {
…
}
public class NegociacaoPlano extends NegociacaoTarifa {
….
}
public class ConfiguracaoAssinatura {
...
private PlanoFaturamento planoFaturamento ;
private Collection negociacoesPlano ;
}
public class PlanoFaturamento {
}
The problem is that when I fill the collection negociacoesPlano and try to save an object of ConfiguracaoAssinatura, the table that represents the class negociacoesPlano is not being update correctly. The field BIPL_ID from this table is always NULL after update, when it should hold the foreign key from table BIPL_BILL_PLAN, BIPL_ID. What is missing?? The hbm files are these below.
File negociacaotarifa.hbm.xml :
<? xml version= "1.0"?>
<! DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
< hibernate-mapping package ="br.com.vivo.scc.model.entity.hibernate" >
<class name="NegociacaoTarifa" table="NETA_NEGOCIACAO_TARIFA"
abstract ="true" polymorphism= "implicit">
< cache usage ="read-write" />
< id name ="id" type= "java.lang.Long" column ="NETA_ID" >
<generator class= "sequence">
<param name="sequence" >
NETA_NEGOCIACAO_TARIFA_SEQ
</ param>
</ generator>
</ id>
< discriminator column ="NETA_TP" type= "string"/>
< many-to-one name ="configuracaoAssinatura" class= "ConfiguracaoAssinatura">
< column name ="ITPE_ITEM_CD" />
</ many-to-one>
< property name ="tipoNeg" type= "java.lang.String" column ="NETA_TP" length= "2" insert ="false" update= "false" />
< property name ="tarifa" type= "java.lang.Long" column ="NETA_TARF_SQ" length= "10" />
< property name ="tipoNegTar" type= "java.lang.String" column ="NETA_TARF_TP" length= "2" />
< property name ="percNeg" type= "java.lang.Float" column ="NETA_TARF_PCT" />
< property name ="valorNeg" column= "NETA_TARF_VL" type ="java.lang.Double" length= "12" />
< property name ="valorBase" column= "NETA_TARF_BASE_VL" type ="java.lang.Double" length= "12" />
<!-- Associations -->
< subclass name ="NegociacaoPlano" discriminator-value= "P">
< many-to-one name ="planoFaturamento" class= "PlanoFaturamento">
< column name ="BIPL_ID" />
</ many-to-one>
</ subclass>
</class>
</ hibernate-mapping>
File configuracaoassinatura.hbm.xml :
<? xml version ="1.0" ?>
<! DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
< hibernate-mapping package ="br.com.vivo.scc.model.entity.hibernate" >
<class name="ConfiguracaoAssinatura" table= "ITPE_ITEM_PEDIDO">
<cache usage= "read-write" />
< id name ="id" column= "ITPE_ITEM_CD" type ="java.lang.Long" >
< generator class ="foreign" >
< param name ="property" >servicoItem </param >
</ generator>
</ id>
<!-- Associations -->
< one-to-one name ="servicoItem" class= "ServicoItem"
cascade ="save-update" />
< one-to-one name ="pedido" class= "Pedido" />
< many-to-one name ="pacoteMinutos" class= "PacoteMinutos">
< column name ="PACM_PACOTE_CD" />
</ many-to-one>
< one-to-one name ="planoFaturamento" class= "PlanoFaturamento" />
< many-to-one
name ="programaMarketingAtlys"
class ="ProgramaMarketingAtlys"
column ="PGMA_ID"
/>
<idbag name ="negociacoesPlano" table ="NETA_NEGOCIACAO_TARIFA">
< collection-id type ="java.lang.Long" column= "NETA_ID">
<generator class= "sequence">
<param name="sequence" >
NETA_NEGOCIACAO_TARIFA_SEQ
</ param>
</ generator>
</ collection-id>
< key column ="ITPE_ITEM_CD" />
< composite-element class ="NegociacaoPlano" >
< property name ="tipoNeg" column= "NETA_TP"/>
< property name ="tarifa" column= "NETA_TARF_SQ"/>
< property name ="tipoNegTar" column= "NETA_TARF_TP"/>
< property name ="percNeg" column= "NETA_TARF_PCT"/>
< property name ="valorNeg" column= "NETA_TARF_VL"/>
<property name= "valorBase" column= "NETA_TARF_BASE_VL"/>
</composite-element >
</idbag>
</class>
</ hibernate-mapping>
File planofaturamento.hbm.xml:
<? xml version ="1.0" ?>
<! DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
< hibernate-mapping package ="br.com.vivo.scc.model.entity.hibernate" >
< class
name ="PlanoFaturamento"
table ="BIPL_BILL_PLAN"
>
< cache usage ="read-write" />
< id
name ="id"
type ="java.lang.Long"
column ="BIPL_ID"
>
< generator class ="assigned" />
</ id>
< property
name ="codigo"
type ="java.lang.String"
column ="BIPL_BILL_PLAN_CODE"
unique ="true"
length ="20"
/>
< property
name ="descricao"
type ="java.lang.String"
column ="BIPL_DESCRIPTION"
length ="40"
/>
< property
name ="ativo"
type ="br.com.vivo.framework.utility.HibernateSNBoolean"
column ="BIPL_ATIVO"
length ="1"
/>
<!-- Associations -->
<many-to-one
name ="rootCSA"
class ="RootCSA" >
< column name ="ROCS_ID" />
</ many-to-one>
<!-- derived association(s) for compound key -->
<!-- end of derived association(s) -->
< bag name ="tiposPlano" inverse= "true" >
< key column ="BIPL_ID" />
< one-to-many class ="TipoPlano" />
</ bag>
< bag name ="tiposPlanoAtivo" inverse= "true" where ="TIPL_ATIVO_FL='S'" >
< key column ="BIPL_ID" />
< one-to-many class ="TipoPlano" />
</ bag>
< bag name ="pacotesPlano" inverse= "true">
< key column ="BIPL_ID" />
< one-to-many class ="PacotePlano" />
</ bag>
< bag name ="planosIsento" inverse= "true">
< key column ="BIPL_ID" />
< one-to-many class ="PlanoIsento" />
</ bag>
< bag name ="csas" cascade= "none" inverse ="false" >
< subselect>
select distinct coar.COAR_ID, bipl.BIPL_ID
from BIPL_BILL_PLAN bipl
inner join SECS_SERVICOS_CSA secs on secs.SECS_NAME = bipl.BIPL_BILL_PLAN_CODE
inner join COAR_CONTROLE_AREA coar on coar.COAR_ID = secs.COAR_ID and coar.ROCS_ID = bipl.ROCS_ID
where secs.SECS_ATIVO_FL = 'S'
</ subselect>
< key column ="BIPL_ID" />
< many-to-many class ="CSA" column= "COAR_ID"/>
</ bag>
< many-to-one
name ="servico"
class ="Servico"
cascade ="none"
insert ="false"
update ="false"
>
< column name ="BIPL_BILL_PLAN_CODE" />
</ many-to-one>
</ class>
< sql-query name ="planoFaturamento.listarByTecnologia" >
< return alias ="BPLAN" class= "PlanoFaturamento" />
SELECT DISTINCT
{BPLAN.*}
FROM
BIPL_BILL_PLAN {BPLAN}
INNER JOIN TIPL_TIPO_PLANO TIPOSPLANO1_ ON {BPLAN}.BIPL_ID = TIPOSPLANO1_.BIPL_ID AND TIPOSPLANO1_.TIPL_ATIVO_FL='S'
INNER JOIN TPGE_TIPO_PLANO_GERENCIA GERENCIAS10_ ON TIPOSPLANO1_.TIPL_ID = GERENCIAS10_.TIPL_ID
INNER JOIN TBGE_TABELA_GERENCIA GERENCIAS3_ ON GERENCIAS10_.TBGE_GERENCIA_CD = GERENCIAS3_.TBGE_GERENCIA_CD
INNER JOIN ARGE_AREA_GERENCIA AGENTES12_ ON GERENCIAS3_.TBGE_GERENCIA_CD = AGENTES12_.TBGE_GERENCIA_CD
INNER JOIN CAAG_CADASTRO_AGENTE AGENTES2_ ON AGENTES12_.POVE_AGENTE_CD=AGENTES2_.COD_CREDENC
INNER JOIN (
SELECT /*+FIRST_ROWS */ DISTINCT COAR.COAR_ID, BIPL.BIPL_ID FROM BIPL_BILL_PLAN BIPL
INNER JOIN SECS_SERVICOS_CSA SECS ON SECS.SECS_NAME = BIPL.BIPL_BILL_PLAN_CODE
INNER JOIN COAR_CONTROLE_AREA COAR ON COAR.COAR_ID = SECS.COAR_ID AND COAR.ROCS_ID = BIPL.ROCS_ID
WHERE SECS.SECS_ATIVO_FL = 'S') CSAS15_ ON {BPLAN}.BIPL_ID = CSAS15_.BIPL_ID
INNER JOIN COAR_CONTROLE_AREA CSA4_ ON CSAS15_.COAR_ID = CSA4_.COAR_ID
WHERE
{BPLAN}.CHTY_ID IN (SELECT CHTY_ID FROM TCCH_TITC_CHTY WHERE TITC_TECNOLOGIA_CD IN (:tecnologias)) AND
TIPOSPLANO1_.TIPL_TIPO_PLANO_CD = :tipoPlanoCd AND
{BPLAN}.BIPL_ATIVO = :ativo AND
CSA4_.COAR_ID = :csaId AND
AGENTES2_.COD_CREDENC = :codCredenc
ORDER BY
{BPLAN}.BIPL_DESCRIPTION ASC
</ sql-query>
</ hibernate-mapping>
The tables are these:
For class PlanoFaturamento:
CREATE TABLE BIPL_BILL_PLAN (
BIPL_ID NUMBER (10 ) NOT NULL,
BIPL_BILL_PLAN_CODE VARCHAR2 (20 ) NOT NULL,
BIPL_DESCRIPTION VARCHAR2 (40 ) NOT NULL,
BIPL_TYPE VARCHAR2 (2 ) NOT NULL,
BIPL_ATIVO CHAR (1 ) NOT NULL,
ROCS_ID NUMBER (3 ) NOT NULL,
CHTY_ID NUMBER (3 ),
CONSTRAINT UK_BIPL_01
UNIQUE ( BIPL_BILL_PLAN_CODE, ROCS_ID),
CONSTRAINT PK_BIPL_BILL_PLAN
PRIMARY KEY ( BIPL_ID ) ) ;
ALTER TABLE BIPL_BILL_PLAN ADD CONSTRAINT FK_BIPL_ROCS_01
FOREIGN KEY ( ROCS_ID)
REFERENCES SCC_RJ_DES. ROCS_ROOT_CSA (ROCS_ID ) ;
ALTER TABLE BIPL_BILL_PLAN ADD CONSTRAINT FK_BIPL_CHTY_01
FOREIGN KEY ( CHTY_ID)
REFERENCES SCC_RJ_DES. CHTY_CHANNEL_TYPE (CHTY_ID ) ;
For Class NegociacaoTarifa
CREATE TABLE NETA_NEGOCIACAO_TARIFA (
NETA_ID NUMBER (10 ) NOT NULL,
ITPE_ITEM_CD NUMBER (10 ) NOT NULL,
NETA_TP CHAR ( 1) NOT NULL,
BIPL_ID NUMBER (10 ),
BIPV_ID NUMBER (10 ),
PACM_PACOTE_CD NUMBER ( 10),
DENC_ENCARGO_CD NUMBER (10 ),
NETA_TARF_SQ NUMBER (10 ) NOT NULL,
NETA_TARF_TP CHAR ( 1) NOT NULL,
NETA_TARF_PCT NUMBER (6 ,2 ),
NETA_TARF_VL NUMBER (12 ,2 ),
NETA_TARF_BASE_VL NUMBER (12 ,2 ),
CONSTRAINT UK_NETA_BIPL
UNIQUE ( ITPE_ITEM_CD, NETA_TP, BIPL_ID, NETA_TARF_SQ),
CONSTRAINT UK_NETA_BIPV
UNIQUE ( ITPE_ITEM_CD, NETA_TP, BIPV_ID, NETA_TARF_SQ),
CONSTRAINT UK_NETA_DENC
UNIQUE ( ITPE_ITEM_CD, NETA_TP, DENC_ENCARGO_CD, NETA_TARF_SQ),
CONSTRAINT UK_NETA_PACM
UNIQUE (ITPE_ITEM_CD , NETA_TP, PACM_PACOTE_CD, NETA_TARF_SQ),
CONSTRAINT PK_NETA_NEGOCIACAO_TARIFA
PRIMARY KEY ( NETA_ID ) ) ;
ALTER TABLE NETA_NEGOCIACAO_TARIFA ADD CONSTRAINT FK_NETA_BIPV_01
FOREIGN KEY ( BIPV_ID)
REFERENCES SCC_RJ_DES. BIPV_BILL_PLAN_VOLUME (BIPV_ID ) ;
ALTER TABLE NETA_NEGOCIACAO_TARIFA ADD CONSTRAINT FK_NETA_ITPE_01
FOREIGN KEY ( ITPE_ITEM_CD)
REFERENCES SCC_RJ_DES. ITPE_ITEM_PEDIDO (ITPE_ITEM_CD ) ;
ALTER TABLE NETA_NEGOCIACAO_TARIFA ADD CONSTRAINT FK_NETA_BIPL_01
FOREIGN KEY ( BIPL_ID)
REFERENCES SCC_RJ_DES. BIPL_BILL_PLAN (BIPL_ID ) ;
ALTER TABLE NETA_NEGOCIACAO_TARIFA ADD CONSTRAINT FK_NETA_PACM_01
FOREIGN KEY ( PACM_PACOTE_CD)
REFERENCES SCC_RJ_DES. PACM_PACOTE_MINUTOS (PACM_PACOTE_CD ) ;
ALTER TABLE NETA_NEGOCIACAO_TARIFA ADD CONSTRAINT FK_NETA_DENC_01
FOREIGN KEY ( DENC_ENCARGO_CD)
REFERENCES SCC_RJ_DES. DENC_DESCRICAO_ENCARGO (DENC_ENCARGOS_CD ) ;
For Class ConfiguracaoAssinatura:
CREATE TABLE ITPE_ITEM_PEDIDO (
ITPE_ITEM_CD NUMBER (10 ) NOT NULL,
ITPE_ITEM_VL NUMBER (12 ,2 ),
ITPE_HEXA_HX VARCHAR2 (20 ),
ITPE_AREA_NU VARCHAR2 ( 3),
ITPE_CONTA_MESTRE_NU VARCHAR2 (10 ),
ITPE_CONTA_NU VARCHAR2 (10 ),
ITPE_CELULAR_NU VARCHAR2 (8 ),
ITPE_TROCA_CD NUMBER (10 ),
ITPE_TERMO_NU NUMBER (10 ),
ITPE_CEDENTE_NO VARCHAR2 (60 ),
ITPE_CPF_NU VARCHAR2 (20 ),
ITPE_CNPJ_NU VARCHAR2 (14 ),
TIMG_TIPO_MIGRACAO_CD NUMBER (8 ),
REPE_PEDIDO_NU NUMBER (10 ) NOT NULL,
TISE_TIPO_SERVICO_CD NUMBER (10 ),
TITR_TIPO_TRANSFERENCIA_CD NUMBER (10 ),
PEFI_CPF_NU VARCHAR2 (11 ),
STIT_STATUS_CD NUMBER (10 ),
VEPE_VENCIMENTO_CD NUMBER ( 10),
ITPE_NOVA_CONTA_NU VARCHAR2 (12 ),
ITPE_NOVO_CELULAR_NU VARCHAR2 (12 ),
ITPE_CESS_OBS_SCI VARCHAR2 (4000 ),
ITPE_CESS_OBS_CABS VARCHAR2 (100 ),
ITPE_CED_OBS_SCI VARCHAR2 (4000 ),
ITPE_CED_OBS_CABS VARCHAR2 (100 ),
ISPR_ISP_CODE VARCHAR2 ( 3),
PACM_PACOTE_CD NUMBER (10 ),
ITPE_VENCIMENTO_CD NUMBER (10 ),
ITPE_PRAZO_PAGAMENTO_CD NUMBER (10 ),
TIPE_PRAZO_SMP_CD NUMBER (10 ),
ITPE_FORMA_ENTREGA_FL CHAR (1 ),
ITPE_RESPONSAVEL_NO VARCHAR2 (200 ),
ITPE_ENTREGA_DT DATE ,
ITPE_ENTREGA_TURNO_FL CHAR (1 ),
ITPE_TELEFONE_CONTATO_NU VARCHAR2 (15 ),
ITPE_OBSERVACOES_DS VARCHAR2 (255 ),
ITPE_CLIENTE_FL CHAR (1 ),
ITPE_PREENCHIMENTO_DT DATE ,
ITPE_LEITURA_SERIAL_DT DATE,
ITPE_PROGRAMACAO_DT DATE ,
ITPE_ENDERECO_ENTREGA_DS VARCHAR2 (255 ),
ITPE_RG_NU VARCHAR2 (15 ),
ITPE_NASCIMENTO_DT DATE ,
ITPE_PAI_NO VARCHAR2 (100 ),
ITPE_MAE_NO VARCHAR2 (100 ),
ITPE_RESPONSAVEL_CPF_NU VARCHAR2 (15 ),
ITPE_VALOR_FINAL_VL NUMBER (12 ,2 ),
ITPE_DESCONTO_VL VARCHAR2 (12 ),
PEFI_PESSOA_CD NUMBER (18 ),
TRPE_TRANSPORTADORA_NU NUMBER (10 ),
USUA_ID_PREENCHIMENTO NUMBER (6 ),
COAR_ID NUMBER (10 ),
FOPA_CD NUMBER (10 ),
TPRO_ID NUMBER ,
ITPE_IMPRESSAO_ETIQ_DT DATE ,
PELO_LOGISTICA_ID NUMBER (10 ),
BIPL_ID NUMBER (10 ),
BIPV_ID NUMBER (10 ),
ITPE_QTDE_NU NUMBER (5 ) DEFAULT 1,
ITPE_SIMCARD_ITEM_CD NUMBER (10 ),
RETI_CODIGO NUMBER ,
REMT_ID NUMBER (10 ),
PGMA_ID NUMBER (5 ),
CONSTRAINT UK_ITPE_01
UNIQUE ( ITPE_SIMCARD_ITEM_CD),
CONSTRAINT PK_ITPE_ITEM_PEDIDO
PRIMARY KEY ( ITPE_ITEM_CD ) ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_BIPL_01
FOREIGN KEY ( BIPL_ID)
REFERENCES SCC_RJ_DES. BIPL_BILL_PLAN (BIPL_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_BIPV_01
FOREIGN KEY ( BIPV_ID)
REFERENCES SCC_RJ_DES. BIPV_BILL_PLAN_VOLUME (BIPV_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_PGMA_01
FOREIGN KEY ( PGMA_ID)
REFERENCES SCC_RJ_DES. PGMA_PGMK_ATLYS (PGMA_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_REMT_01
FOREIGN KEY ( REMT_ID)
REFERENCES SCC_RJ_DES. REMT_RETI_MOTR (REMT_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_ITPE_01
FOREIGN KEY ( ITPE_SIMCARD_ITEM_CD)
REFERENCES SCC_RJ_DES. ITPE_ITEM_PEDIDO (ITPE_ITEM_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_COAR_01
FOREIGN KEY ( COAR_ID)
REFERENCES SCC_RJ_DES. COAR_CONTROLE_AREA (COAR_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_FOPA_01
FOREIGN KEY ( FOPA_CD)
REFERENCES SCC_RJ_DES. FOPA_FORMA_PAGAMENTO (FOPA_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_PACM_01
FOREIGN KEY ( PACM_PACOTE_CD)
REFERENCES SCC_RJ_DES. PACM_PACOTE_MINUTOS (PACM_PACOTE_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_PEFI_01
FOREIGN KEY ( PEFI_PESSOA_CD)
REFERENCES SCC_RJ_DES. PEFI_PESSOA_FISICA (PEFI_PESSOA_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_PRCO_01
FOREIGN KEY ( TIPE_PRAZO_SMP_CD)
REFERENCES SCC_RJ_DES. PRCO_PRAZO_COMODATO (PRCO_PRAZO_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_PRPA_01
FOREIGN KEY ( ITPE_PRAZO_PAGAMENTO_CD )
REFERENCES SCC_RJ_DES .PRPA_PRAZO_PAGAMENTO ( PRPA_PRAZO_CD) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_REPE_01
FOREIGN KEY ( REPE_PEDIDO_NU)
REFERENCES SCC_RJ_DES. REPE_RELACAO_PEDIDO (REPE_PEDIDO_NU ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_STIT_01
FOREIGN KEY ( STIT_STATUS_CD)
REFERENCES SCC_RJ_DES. STIT_STATUS_ITEM (STIT_STATUS_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_TIMG_01
FOREIGN KEY ( TIMG_TIPO_MIGRACAO_CD)
REFERENCES SCC_RJ_DES. TIMG_TIPO_MIGRACAO (TIMG_TIPO_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_TISE_01
FOREIGN KEY ( TISE_TIPO_SERVICO_CD)
REFERENCES SCC_RJ_DES. TISE_TIPO_SERVICO (TISE_TIPO_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_TITR_01
FOREIGN KEY ( TITR_TIPO_TRANSFERENCIA_CD)
REFERENCES SCC_RJ_DES. TITR_TIPO_TRANSFERENCIA (TITR_TIPO_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_TPRO_01
FOREIGN KEY ( TPRO_ID)
REFERENCES SCC_RJ_DES. TPRO_TABELA_PRODUTO (TPRO_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_TRPE_01
FOREIGN KEY (TRPE_TRANSPORTADORA_NU )
REFERENCES SCC_RJ_DES .TRPE_TRANSPORTADORA_PEDIDO ( TRPE_TRANSPORTADORA_NU) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_TRSE_01
FOREIGN KEY ( ITPE_TROCA_CD)
REFERENCES SCC_RJ_DES. TRSE_TROCA_SERIAL (TRSE_TROCA_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_USUA_01
FOREIGN KEY ( USUA_ID_PREENCHIMENTO)
REFERENCES SCC_RJ_DES. USUA_USUARIO (USUA_ID ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_VEPE_01
FOREIGN KEY ( VEPE_VENCIMENTO_CD)
REFERENCES SCC_RJ_DES. VEPE_VENCIMENTO_PEDIDO (VEPE_VENCIMENTO_CD ) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_PELO_01
FOREIGN KEY ( PELO_LOGISTICA_ID)
REFERENCES SCC_RJ_DES .PELO_PEDIDO_LOGISTICA ( PELO_LOGISTICA_ID) ;
ALTER TABLE ITPE_ITEM_PEDIDO ADD CONSTRAINT FK_ITPE_RETI_01
FOREIGN KEY (RETI_CODIGO )
REFERENCES SCC_RJ_DES .RETI_RELACIONA_TIPO_SERVICO ( RETI_CODIGO) ;
CREATE INDEX IDX_PELO_LOGISTICA_ID ON
ITPE_ITEM_PEDIDO( PELO_LOGISTICA_ID)
;
CREATE INDEX ITPE_ITEM_PEDIDO_IDX ON
ITPE_ITEM_PEDIDO( REPE_PEDIDO_NU)
;
CREATE INDEX IDX_PEFI_CPF_NU ON
ITPE_ITEM_PEDIDO (PEFI_CPF_NU )
;
CREATE INDEX IDX_ITPE_CELULAR_NU ON
ITPE_ITEM_PEDIDO (ITPE_CELULAR_NU )
;
Any help would be appreciated!!
Thanks
James
|