Hi

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?

Thanks!

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


      
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

Reply via email to