You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by thomas fischer <fi...@seitenbau.de> on 2005/06/17 16:37:17 UTC

[SOURCE] Issue #TRQS304 - Handling of instantiaton errors for Mapbuilder

You can view the issue detail at the following URL:

    http://issues.apache.org/scarab/issues/id/TRQS304

Type
 Defect

Issue ID
 TRQS304 (Handling of instantiaton errors for Mapbuilder)

Reported by
 thomas fischer
 fischer@seitenbau.de (fischer@seitenbau.de)

New issue details:
---------------------------------------------------------

Summary set to "Handling of instantiaton error..."
Status set to "New"
Priority set to "Medium"
Description set to "in BasePeer.getMapBuilder(Stri..."
Issue created

---------------------------------------------------------
This message is automatically generated by the Scarab
issue tracking system.  For more information:
http://scarab.tigris.org/



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


Re: Inheritence question

Posted by Thomas Fischer <fi...@seitenbau.net>.



Jonathan,

Thanks for your changes, I Hope I will have time to look at them soon and
commit them.

Jonathan Purvis <jo...@reeltwo.com> schrieb am 22.06.2005 06:07:14:

> Thomas Fischer wrote:
> > In my opinion, it is a good idea to put the base packages into a
> > subdirectory. However, I am not so sure about backwards compatibility
> > there. Probably one would want to make this configurable (preferably
via a
> > configurable package suffix)
>
> Yes, we added an "extensionPackage" field for the classes that extend
> the base classes, so our database tag has these fields:
>    package="project.db.generated"
>    extensionPackage="project.db"

I would rather configure this in the build.properties of the generator than
in the database dtd. There, similare features are already configured. But
it should be no problem to change that.

   Thomas


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


Re: Inheritence question

Posted by Jonathan Purvis <jo...@reeltwo.com>.
Thomas Fischer wrote:
> I am happy to hear this. Of course we are interested in these patches.
> I would guess that the "protected" part of the patch is not problematic to
> implement, and also the foreign key part should be ok.
> In my opinion, it is a good idea to put the base packages into a
> subdirectory. However, I am not so sure about backwards compatibility
> there. Probably one would want to make this configurable (preferably via a
> configurable package suffix)

Yes, we added an "extensionPackage" field for the classes that extend 
the base classes, so our database tag has these fields:
   package="project.db.generated"
   extensionPackage="project.db"

> I do not know how many files you have patched and against which version. If
> there are not too many changed files, I would appreciate it if you create
> an issue in scarab and append the complete files there (please do not diff
> if possible, some velocity templates have changed a bit in the meantime in
> cvs). If you prefer it, you can also mail the files directly to me.

I've made an issue in scarab for this: 
<http://issues.apache.org/scarab/issues/id/TRQS306> with the 4 changed 
files attached.


Regards,

     Jon

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


Re: Inheritence question

Posted by Thomas Fischer <fi...@seitenbau.net>.



I am happy to hear this. Of course we are interested in these patches.
I would guess that the "protected" part of the patch is not problematic to
implement, and also the foreign key part should be ok.
In my opinion, it is a good idea to put the base packages into a
subdirectory. However, I am not so sure about backwards compatibility
there. Probably one would want to make this configurable (preferably via a
configurable package suffix)

I do not know how many files you have patched and against which version. If
there are not too many changed files, I would appreciate it if you create
an issue in scarab and append the complete files there (please do not diff
if possible, some velocity templates have changed a bit in the meantime in
cvs). If you prefer it, you can also mail the files directly to me.

     Thomas


Jonathan Purvis <jo...@reeltwo.com> schrieb am 20.06.2005 22:45:02:

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


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


Re: Inheritence question

Posted by Jonathan Purvis <jo...@reeltwo.com>.
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


RE: Inheritence question

Posted by Thomas Fischer <fi...@seitenbau.net>.



Is that already supported or is this a suggestion ? If it is a suggestion,
can you please open up a scarab issue on that ?

         Thanks,

               Thomas

"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 20.06.2005 11:44:34:

> Another way is to add a children element "class" to column and only the
> defined classes will have methods for this specific column.
> For example (using my previous example):
>
> <table name="A">
>     <column name="a" type="INTEGER" primaryKey="true"/>
>     <column name="b" type="INTEGER" primaryKey="true">
>        <class class="B"/>
>     </column>
>     <column name="c" type="INTEGER" primaryKey="true">
>        <class class="C"/>
>     </column>
>     <column name="FOO" inheritance="single" type="CHAR" size="1">
>        <inheritance key="B" class="B"
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>        <inheritance key="C" class="C"
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>     </column>
>  </table>
>
>
> -----Original Message-----
> From: Thomas Fischer [mailto:fischer@seitenbau.net]
> Sent: Monday, June 20, 2005 9:59 AM
> To: Apache Torque Developers List
> Subject: RE: Inheritence question
>
>
>
>
>
>
> Hi,
>
> 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.
>
>           Thomas
>
> "Mickey Mokotov" <mi...@fetchbook.info> schrieb am 19.06.2005 19:11:42:
>
> > Hi fellows,
> > I'm a bit embraced to ask but I can't find it on the docs, nor any
> example
> > on the web.
> >
> > I understand that torque implements inheritance using one table and I
> have a
> > question with regards to the properties-
> >
> > Let's say class B and C inherits from A.
> > A has the attribute a.
> > B has the attribute b (and the one inherited from A).
> > C has the attribute c (and the one inherited from A).
> >
> > Is there any way to avoid the situation in which class B has all three
> > methods getA() ... getC() ?
> >
> > E.g. have a schema other than:
> >
> > <table name="A">
> >    <column name="a" type="INTEGER" primaryKey="true"/>
> >    <column name="b" type="INTEGER" primaryKey="true"/>
> >    <column name="c" type="INTEGER" primaryKey="true"/>
> >    <column name="FOO" inheritance="single" type="CHAR" size="1">
> >       <inheritance key="B" class="B"
> > extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
> >       <inheritance key="C" class="C"
> > extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
> >    </column>
> > </table>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-dev-help@db.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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


RE: Inheritence question

Posted by Mickey Mokotov <mi...@fetchbook.info>.
Another way is to add a children element "class" to column and only the
defined classes will have methods for this specific column.
For example (using my previous example):

<table name="A">
    <column name="a" type="INTEGER" primaryKey="true"/>
    <column name="b" type="INTEGER" primaryKey="true">
    	<class class="B"/>
    </column>
    <column name="c" type="INTEGER" primaryKey="true">
    	<class class="C"/>
    </column>
    <column name="FOO" inheritance="single" type="CHAR" size="1">
       <inheritance key="B" class="B"
extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
       <inheritance key="C" class="C"
extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
    </column>
 </table>


-----Original Message-----
From: Thomas Fischer [mailto:fischer@seitenbau.net] 
Sent: Monday, June 20, 2005 9:59 AM
To: Apache Torque Developers List
Subject: RE: Inheritence question






Hi,

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.

          Thomas

"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 19.06.2005 19:11:42:

> Hi fellows,
> I'm a bit embraced to ask but I can't find it on the docs, nor any
example
> on the web.
>
> I understand that torque implements inheritance using one table and I
have a
> question with regards to the properties-
>
> Let's say class B and C inherits from A.
> A has the attribute a.
> B has the attribute b (and the one inherited from A).
> C has the attribute c (and the one inherited from A).
>
> Is there any way to avoid the situation in which class B has all three 
> methods getA() ... getC() ?
>
> E.g. have a schema other than:
>
> <table name="A">
>    <column name="a" type="INTEGER" primaryKey="true"/>
>    <column name="b" type="INTEGER" primaryKey="true"/>
>    <column name="c" type="INTEGER" primaryKey="true"/>
>    <column name="FOO" inheritance="single" type="CHAR" size="1">
>       <inheritance key="B" class="B" 
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>       <inheritance key="C" class="C" 
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>    </column>
> </table>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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



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


RE: Inheritence question

Posted by Thomas Fischer <fi...@seitenbau.net>.



Hi,

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.

          Thomas

"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 19.06.2005 19:11:42:

> Hi fellows,
> I'm a bit embraced to ask but I can't find it on the docs, nor any
example
> on the web.
>
> I understand that torque implements inheritance using one table and I
have a
> question with regards to the properties-
>
> Let's say class B and C inherits from A.
> A has the attribute a.
> B has the attribute b (and the one inherited from A).
> C has the attribute c (and the one inherited from A).
>
> Is there any way to avoid the situation in which class B has all three
> methods getA() ... getC() ?
>
> E.g. have a schema other than:
>
> <table name="A">
>    <column name="a" type="INTEGER" primaryKey="true"/>
>    <column name="b" type="INTEGER" primaryKey="true"/>
>    <column name="c" type="INTEGER" primaryKey="true"/>
>    <column name="FOO" inheritance="single" type="CHAR" size="1">
>       <inheritance key="B" class="B"
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>       <inheritance key="C" class="C"
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>    </column>
> </table>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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


Inheritence question

Posted by Mickey Mokotov <mi...@fetchbook.info>.
Hi fellows,
I'm a bit embraced to ask but I can't find it on the docs, nor any example
on the web.

I understand that torque implements inheritance using one table and I have a
question with regards to the properties-

Let's say class B and C inherits from A.
A has the attribute a.
B has the attribute b (and the one inherited from A).
C has the attribute c (and the one inherited from A).

Is there any way to avoid the situation in which class B has all three
methods getA() ... getC() ?

E.g. have a schema other than:

<table name="A">
	<column name="a" type="INTEGER" primaryKey="true"/>
	<column name="b" type="INTEGER" primaryKey="true"/>
	<column name="c" type="INTEGER" primaryKey="true"/>
	<column name="FOO" inheritance="single" type="CHAR" size="1">
		<inheritance key="B" class="B"
extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
		<inheritance key="C" class="C"
extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
	</column>
</table>


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