You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Chris Worley <cw...@insect.com> on 2005/12/05 21:47:11 UTC

Forgein Key Not Set

I have a problem where the forgein key ids are not set in the object or 
db after the forgein object has been created.

TABLE_A
-A_ID

TABLE_B
-B_ID
-A_ID

In the mappings tableB has a reference descriptor for tableA

TableA tableA = new TableA();
TableB tableB = new TableB();
tableB.setA(tableA);

At this point the objects are serialized, sent and recreated on the server.

getBroker().store(tableA);
getBroker().store(tableB);

When I look in the db table_b has the value of 0 for a_id. 

When getBroker().store(tableA) is executed I can see the a_id set in  
tableB.tableA.a_id but, I do not see the change in tableB.a_id.  When 
table b is stored the value for a_id remains unset with the value of 0 
even though tableB.tableA.a_id has the value set to 1 or whatever it was 
assigned.



-chris worley

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Forgein Key Not Set

Posted by Chris Worley <cw...@insect.com>.
geez... sometimes when you stare at xml to long the its hard to find the 
simplest mistakes.

I did not have the foreignkey tag in my reference descriptor.

problem solved

-chris worley

>
> I have a problem where the forgein key ids are not set in the object 
> or db after the forgein object has been created.
>
> TABLE_A
> -A_ID
>
> TABLE_B
> -B_ID
> -A_ID
>
> In the mappings tableB has a reference descriptor for tableA
>
> TableA tableA = new TableA();
> TableB tableB = new TableB();
> tableB.setA(tableA);
>
> At this point the objects are serialized, sent and recreated on the 
> server.
>
> getBroker().store(tableA);
> getBroker().store(tableB);
>
> When I look in the db table_b has the value of 0 for a_id.
> When getBroker().store(tableA) is executed I can see the a_id set in  
> tableB.tableA.a_id but, I do not see the change in tableB.a_id.  When 
> table b is stored the value for a_id remains unset with the value of 0 
> even though tableB.tableA.a_id has the value set to 1 or whatever it 
> was assigned.
>
>
>
> -chris worley
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org