RE: 1 to 1 mapping

2004-03-22 Thread McCaffrey, John G.
So, is there any way I can I configure my mapping (or query) to build an
Object A that contains a collection of Object Bs joined only on Node_ID
(even though both mappings have other PKs)? 

I don't really get why all the primary keys have to be the
collection/reference-descriptor. I just don't have that information when I
am joining the two tables (the only thing I have is Node_ID). 

For example one of the primary keys is an effective_date, which I will Never
actually know, all I will know is that the effective_date is <= current
Date, and the end_effective_date is > current Date. Thats the way that I
will find my rows.

-Original Message-
From: McCaffrey, John G. [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 1:12 PM
To: 'OJB Users List'
Subject: RE: 1 to 1 mapping


Armin, 
First, Thanks for responding I appreciate your assitance.

My problem is that the table B can only be joined to Table A using one field
(Node_ID), as the other keys from table A are not in the actual table B.
(even the Process_Date field that is in Table B, is ITs process_date, and
can't be used for a join)

How can I configure my mapping (or query) to build an Object A that contains
a collection of Object Bs joined only on Node_ID?

I could just munge the mapping and make only the Node_ID the primary Key for
both A and B, but I am concerned about the consequences of not telling OJB
what really makes those rows unique. (I think it would adversely affect my
findByPK and insert methods)

thanks again for your help 



-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 12:35 PM
To: OJB Users List
Subject: Re: 1 to 1 mapping


Hi John,

you have to declare all PK fields in the collection/reference-descriptor 
inverse-foreignkey/foreignkey tags.

McCaffrey, John G. wrote:
> I am trying to join two tables A and B
> table A has three primary keys
> Main_ID
> Node_ID
> Process_Date
> 
> table B has two primary keys
> Node_ID
> Process_Date
> 
> my mapping has the Table A object containing a collection of B obj

ok, you have an 1:n reference from A to B, thus your 
collection-descriptor should look like


...

   
   
   

...


Means your B class needs three FK fields (to map the PK of A).

regards,
Armin

> I want to join the collection using the Node_ID, because it is the only
> thing they can be joined on
> 
> when I do the mapping
> 
>  proxy="false" auto-retrieve="true" > 
> 
> 
> 
> it complains about an arrayIndexOutOfBounds 
> but it works when the only primary key is Node_ID 
> 
> i don't get it
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: 1 to 1 mapping

2004-03-19 Thread McCaffrey, John G.
Armin, 
First, Thanks for responding I appreciate your assitance.

My problem is that the table B can only be joined to Table A using one field
(Node_ID), as the other keys from table A are not in the actual table B.
(even the Process_Date field that is in Table B, is ITs process_date, and
can't be used for a join)

How can I configure my mapping (or query) to build an Object A that contains
a collection of Object Bs joined only on Node_ID?

I could just munge the mapping and make only the Node_ID the primary Key for
both A and B, but I am concerned about the consequences of not telling OJB
what really makes those rows unique. (I think it would adversely affect my
findByPK and insert methods)

thanks again for your help 



-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 12:35 PM
To: OJB Users List
Subject: Re: 1 to 1 mapping


Hi John,

you have to declare all PK fields in the collection/reference-descriptor 
inverse-foreignkey/foreignkey tags.

McCaffrey, John G. wrote:
> I am trying to join two tables A and B
> table A has three primary keys
> Main_ID
> Node_ID
> Process_Date
> 
> table B has two primary keys
> Node_ID
> Process_Date
> 
> my mapping has the Table A object containing a collection of B obj

ok, you have an 1:n reference from A to B, thus your 
collection-descriptor should look like


...

   
   
   

...


Means your B class needs three FK fields (to map the PK of A).

regards,
Armin

> I want to join the collection using the Node_ID, because it is the only
> thing they can be joined on
> 
> when I do the mapping
> 
>  proxy="false" auto-retrieve="true" > 
> 
> 
> 
> it complains about an arrayIndexOutOfBounds 
> but it works when the only primary key is Node_ID 
> 
> i don't get it
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: 1 to 1 mapping

2004-03-19 Thread Armin Waibel
Hi John,

you have to declare all PK fields in the collection/reference-descriptor 
inverse-foreignkey/foreignkey tags.

McCaffrey, John G. wrote:
I am trying to join two tables A and B
table A has three primary keys
Main_ID
Node_ID
Process_Date
table B has two primary keys
Node_ID
Process_Date
my mapping has the Table A object containing a collection of B obj
ok, you have an 1:n reference from A to B, thus your 
collection-descriptor should look like


...

  
  
  

...

Means your B class needs three FK fields (to map the PK of A).

regards,
Armin
I want to join the collection using the Node_ID, because it is the only
thing they can be joined on
when I do the mapping


proxy="false" auto-retrieve="true" > 



it complains about an arrayIndexOutOfBounds 
but it works when the only primary key is Node_ID 

i don't get it

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: 1 to 1 mapping

2004-03-18 Thread Edson Carlos Ericksson Richter
Use a reference-descriptor to make 1:1 mappings. If you are using 1:N mappings, use a 
collection-descriptor in the 1 side, and a reference-descriptor in the N side.

Best regards,

Edson Richter

  - Original Message - 
  From: McCaffrey, John G. 
  To: 'OJB Users List' 
  Sent: Thursday, March 18, 2004 4:33 PM
  Subject: 1 to 1 mapping


  I am trying to join two tables A and B
  table A has three primary keys
  Main_ID
  Node_ID
  Process_Date

  table B has two primary keys
  Node_ID
  Process_Date

  my mapping has the Table A object containing a collection of B obj
  I want to join the collection using the Node_ID, because it is the only
  thing they can be joined on

  when I do the mapping

   
  
  

  it complains about an arrayIndexOutOfBounds 
  but it works when the only primary key is Node_ID 

  i don't get it


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.624 / Virus Database: 401 - Release Date: 15/3/2004