db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LFS <lfs83mail-apache...@yahoo.com.br>
Subject Persisting object and foreign keys
Date Mon, 29 Jun 2009 19:54:53 GMT

This is my situation: I have an Address object that I
persist/retrieve from the DB. It contains a City object, reperesenting
the city on which that address is. City contains State, and State
contains Country object (a long N-1 chain).
When I'm creating a new
address from user input, the user selected its city from a combo box
which I populated from DB, then I'll have the city's ID.
When I try
to persist the new address, the most I can do is put a City object on
it, containing only the city ID. The problem is that persisting this
will erase the City record for that ID on the DB, because other fields
like Name and State will be null. I want simply to set the foreign id
on the Address object, nothing else.

I believe there is some
good solution for this... my intention is not updating the City object,
and retrieving it to put it back on the address object before being
persisted sounds very strange and a performance nightmare.

What's the proper way to do this?


Note: I'm using application identity and DataNucleus JDO.

Veja quais são os assuntos do momento no Yahoo! +Buscados
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message