db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject "throws TorqueException" in setter for referenced object by a foreign key
Date Fri, 01 Oct 2010 19:31:14 GMT

This question is best explained by an example

If I have
  <table name="book" description="Book table">
    ....
    <foreign-key foreignTable="author">
      <reference local="author_id" foreign="author_id"/>
    </foreign-key>
  </table>
then Torque generates (complexObjectModel=true) in BaseBook:

    public void setAuthor(Author v) throws TorqueException
    {
        if (v == null)
        {
            setAuthorId(0);
        }
        else
        {
            setAuthorId(v.getAuthorId());
        }
        aAuthor = v;
    }

and the question is: why does this method declares to throw a
TorqueException? In the code it is never thrown.

I intend to make this behaviour configurable using the option
torque.om.complexObjectModel.localFieldSetterException
If the default value is set to to TorqaueException, the behaviour of 3.3 is
retained.
But I'd rather set the default behaviour to not throwing an exception
because it forces the user to write unnecessary catch clauses for
exceptions which are never thrown. Any objections ?

       Thomas


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


Mime
View raw message