-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: mapp a collection
PostPosted: Mon Mar 22, 2004 7:53 pm 
Newbie

Joined: Fri Mar 05, 2004 3:22 pm
Posts: 8
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.