db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Chavez <ccha...@agssa.net>
Subject updating PrimaryKey
Date Fri, 17 Feb 2006 20:30:11 GMT
Hello jakob, armin, list.

I have two tables:

table1 (id1, name1)  PrimaryKey is id1.
table2 (id2, id1, name2)  PrimaryKey is id2, ForeignKey is id1 
referencing to table1
There is a relationship one to many from table1 to table2
There is cascade uptade and delete.

when i update the value of the primary key for a record on table1 OJB 
don't update the value of the primary key instead of that create a new 
record.
On table2 OJB update the value of the foreingkey to the new value.

For example:

Table1
id1       name1
1         aaaaaaa

Table2
id2      id1    name2
1         1       bbbbbbb
2         1       cccccccc

when i update the primarykey on table1, for example to 4 the records are:

Table1
id1       name1
1         aaaaaaa
4         aaaaaaa

Table2
id2      id1    name2
1         4       bbbbbbb
2         4       cccccccc

on the table1 create a new record and on the table2 update the 
foreignkey to the new value.

I use db-ojb 1.0.4.

Cheers,
Carlos Chavez.


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


Mime
View raw message