db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artur Z" <arte...@o2.pl>
Subject Re: 1. onDelete 2. 1:n association
Date Fri, 30 Jul 2004 08:51:01 GMT
hello

I tried to use torque onDelete attribute on MSSQL but it did't wokred
db was throwing an exception about constraint violation
maybe I did something wrong

> As a matter of curiosity: what kind of Java code would you want to
generate?
first of all that generates java code, which is generated depending on
onDelete attribute, which deletes (or sets null) all associated objects in
collection
maybe it sounds simple and going into details prove that it is difficult and
I will not be able to do that

but the biggest problem I consider to solve is the lack of such
functionality:
when I operate on object and its assoctated collection I'd like to be able
to "tell" the object to delete one of associated objects
and when I call save it will automaticly delete associated objects I makred
as "to delete"
I also found that this code does'nt work:
Company company = new Company();
Address address = new Address();
company.setAddress(address);
company.save(conn);   // I'd like that this saves also address but it does
not
//but the most important thing is that when I call:
address.save(conn);
//an exception will be thrown - before the above line I shoul do:
company.setAddress(address);
or
address.setCompany(company);

generaly speaking I miss functionality which cares about accosiated objects
(adding/setting/deleting)

please correct me if I'm wrong - I'm no torque guru - maybe I mixed up
soething :)

cheers
Artur


----- Original Message -----
From: "T E Schmitz" <mailreg@numerixtechnology.de>
To: "Apache Torque Users List" <torque-user@db.apache.org>
Sent: Thursday, July 29, 2004 11:27 AM
Subject: Re: 1. onDelete 2. 1:n association


> Hello,
>
> I forgot to mention:
>
> T E Schmitz wrote:
>
> > b) I am using the LEFT/RIGHT/INNER Join patch by Thomas Fischer--
>
> The use of OUTER JOINs required a change to row2Object(...). Previously,
> it was not possible for the FK object to be null. But with OUTER JOINs
> that has to be taken into consideration. Therefore row2Object() needs to
> return null now if all of the FK table's attributes are null. Of course,
> this will not work if using primitive types! You must set
> defaultJavaType="object" to use OUTER JOINs. As I use object types
> myself I didn't bother to cater for primitive types in row2Object(...).
>
> As you can see, doSelectJoinAll (...) is basically a copy of
> doSelectJoinExceptXXX (...). I replaced the double loop by HashMap's,
> which tracks the FK objects already read.
>
>
> Regards/Gruß,
>
> Tarlika Elisabeth Schmitz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>



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


Mime
View raw message