db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Purvis <...@reeltwo.com>
Subject Re: Inheritence question
Date Mon, 20 Jun 2005 20:45:02 GMT
Thomas Fischer wrote:
> I am afraid there is nothing to achieve this out of the box. There is no
> way Torque can know  which column belongs to which class from the
> schema.xml (and I do not know a way how this could be specified).
> Of course you can subclass the setters of the unwanted column and throw an
> exception, making sure that they can never be called. But this is not the
> optimal solution, it would be better if they would not be visible.
> One way to achieve this might be to change the templates such that for
> inheritance base classes, the getters and setters are made protected and
> you make just the wanted columns public in the subclass.

As luck would have it, we have patched Torque to do this.  We added a 
"protected" attribute to the column element, so that when 
protected="true" is defined, the getter and setter for the column is 
protected and can be defined only in the subclass that needs it.

We have also patched Torque to put the base classes in a separate 
package (to ease not checking them into a version control system and not 
subjecting them to style checks) and allow null foreign keys by 
supporting "int" in one table and "Integer" in another.

Are you interested in adding these patches to Torque?


Regards,

	Jon

---------------------------------------------------------------------
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