db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vitzethum, Daniel" <Daniel.Vitzet...@gigatronik.com>
Subject AW: Saving associated objects
Date Wed, 08 Dec 2004 14:22:24 GMT
Hi Thomas,

> I am not sure if I understand the question.

you did ;-)

> (...)
> If you have a real 1:1 behaviour, you can put the foreign key on the
> other side, ...

Indeed it is a 1:1 thing. So it would be possible to switch the FK's
location. But then I'd lose the information in my  "n" table if there
is something associated or not (FK = null).

> If you do not have too many  relations of this sort, a solution would
> be to override the save(..) methods in the persistent Objects.

I choose that one! My solution, worked fine on first try:

Overriding save(Connection):
public void save(Connection con) throws TorqueException {
  if (getOtherObject() != null) {

Thank you!


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

View raw message