Hibernate 2.1
Oracle 9i
Hi everybody.
I'm a begginer in hibernate, so, I need help!
I'm trying to mapp this object:
public class Negocio
{
private IDomicilioNacional m_domicilioComercial;
private IDomicilioNacional m_domicilioFiscal;
public Negocio()
{
}
}
----------
Here are the other objects:
public interface IDomicilioNacional
{
public CodigoPostal getCodigoPostal();
public void setCodigoPostal(CodigoPostal aCodigoPostal);
}
---------
public class DomicilioNacional extends Domicilio implements IDomicilioNacional
{
private CodigoPostal m_codigoPostal;
public DomicilioNacional()
{
}
public CodigoPostal getCodigoPostal()
{
return m_codigoPostal;
}
public void setCodigoPostal(CodigoPostal aCodigoPostal)
{
m_codigoPostal = aCodigoPostal;
}
}
-----------
And now my data base:
I have a table for the "Negocio" object and another table for the "DomicilioNacional" object:
CREATE TABLE TBL_BDU_COMERCIOS --(NEGOCIO)
(
COM_AFIL_AMEX NUMBER(10),
COM_AFIL_DINERS NUMBER(10),
COM_ASC_CVE NUMBER(5),
COM_CHQ_CHEQUERA VARCHAR2(20 BYTE) NOT NULL,
COM_CHQ_CUENTA NUMBER(10),
OID NUMBER(15) NOT NULL,
COM_BCO_ID NUMBER(15) NOT NULL,
COM_BLOQUEO_ID NUMBER(15),
COM_CAT_CRED_ID NUMBER(15) NOT NULL,
)
CREATE UNIQUE INDEX PK_BDU_COMERCIOS ON TBL_BDU_COMERCIOS
(OID)
NOLOGGING
TABLESPACE BDU_NDX
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
NOPARALLEL;
----------
CREATE TABLE TBL_BDU_COMERCIOS_ADDRESS_N --(DomicilioNacional)
(
COM_DOMICILIO VARCHAR2(120 BYTE) NOT NULL,
COM_TELEFONO VARCHAR2(16 BYTE) NOT NULL,
COM_TELEFONO_2 VARCHAR2(16 BYTE),
COM_FAX VARCHAR2(16 BYTE),
COM_EMAIL VARCHAR2(50 BYTE),
COM_ID NUMBER(15) NOT NULL,
COM_CP_ID NUMBER(15) NOT NULL,
COM_TIPO_DATO_ID NUMBER(15) NOT NULL,
OID NUMBER(15) NOT NULL
)
ALTER TABLE TBL_BDU_COMERCIOS_ADDRESS_N ADD (
CONSTRAINT PK_BDU_COM_ADDRESS_N PRIMARY KEY (OID)
USING INDEX
TABLESPACE SYSTEM
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
));
ALTER TABLE TBL_BDU_COMERCIOS_ADDRESS_N ADD (
CONSTRAINT FK_BDU_COM_ADD_N FOREIGN KEY (COM_ID)
REFERENCES TBL_BDU_COMERCIOS (OID));
-------------------
So, my "DomicilioNacional" table, has the "Negocio" id. But in my objects, I have it in the inverse way.
I don't know hoy to mapp this. Please help!
I have the DomicilioNacional Mapping, but I think the problem is to set the DomicilioNacional in my Negocio mapping document.
Thanks very much
Luis Mendoza
Mexico, DF
|