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 jm...@chubb.com on 2005/05/24 23:12:58 UTC

CamelBack notation Output for Spring work

I am trying to produce a working application using Spring and Torque. I
already have Spring working with Hibernate and IBatis using a set of Domain
classes that are written with Camelback notation.  I want to show that you
can port from Hibernate to IBatis to Torque inside a Spring Framework...


2 problems appeared right off the bat:

--- In Hibernate and IBatis you don't include any logic in the domain
objects.
--- I have already designed my Domain objects for use with Hibernate and
IBatis in Camelback Notation and Torque seems to lowercase everything


To this end I am going to create an Interface for my domain ojbects using
the Camelback Notation.  Then I wil make the Torque classes implement this
interface as well as Hiberate and Other objects.


In this way I can have 2 sets of Domain objects.  One set for Hibernate and
IBatis with no logic and one set for Torque.

I have a schema I am describing like this:

 <table name="Attachments">
      <column name="AttachmentId" required="true" autoIncrement="true"
            primaryKey="true" type="INTEGER"/>
    <column name="FileName" required="true" size="255" type="VARCHAR"/>
    <column name="ContentType" required="true" size="50" type="VARCHAR"/>
    <column name="FileData" required="true" size="50" type="BLOB"/>
  </table>

I want my accessor/mutator methods to have names like

      getAttachmentId not getAttachmentid
      getFileName not getFilename

Torque seems to lowercase all the names... Can this be avoided? Is there
any easy way to do this by altering the velocity macros?



John Menke

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


RE: CamelBack notation Output for Spring work

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



Hi,

there are many ways how you can achieve the java names you want. First,
there is the attribute "defaultNamingMethod" or the like, look at the dtd
for further information. There, you should be able to specify something
like "noChange". This would be the preferred way to go. Then, there is the
javaName attribute, where you can specify the java name independent from
the column name (again, see the dtd). The least desirable would be to
change the velocity templates because of update issues.

(By the way, the canonical way to generate uppercase letter in Torque is an
underscore before the letter. So if you would name name the column
Attachment_Id, then the java name would be attachmentId. But you probably
knew this already.)

I cannot help you out with the logic/no logic issue because of my very
limited spring knowledge.

 Hope that helps,

    Thomas

jmenke@chubb.com schrieb am 24.05.2005 23:12:58:

> I am trying to produce a working application using Spring and Torque. I
> already have Spring working with Hibernate and IBatis using a set of
Domain
> classes that are written with Camelback notation.  I want to show that
you
> can port from Hibernate to IBatis to Torque inside a Spring Framework...
>
>
> 2 problems appeared right off the bat:
>
> --- In Hibernate and IBatis you don't include any logic in the domain
> objects.
> --- I have already designed my Domain objects for use with Hibernate and
> IBatis in Camelback Notation and Torque seems to lowercase everything
>
>
> To this end I am going to create an Interface for my domain ojbects using
> the Camelback Notation.  Then I wil make the Torque classes implement
this
> interface as well as Hiberate and Other objects.
>
>
> In this way I can have 2 sets of Domain objects.  One set for Hibernate
and
> IBatis with no logic and one set for Torque.
>
> I have a schema I am describing like this:
>
>  <table name="Attachments">
>       <column name="AttachmentId" required="true" autoIncrement="true"
>             primaryKey="true" type="INTEGER"/>
>     <column name="FileName" required="true" size="255" type="VARCHAR"/>
>     <column name="ContentType" required="true" size="50" type="VARCHAR"/>
>     <column name="FileData" required="true" size="50" type="BLOB"/>
>   </table>
>
> I want my accessor/mutator methods to have names like
>
>       getAttachmentId not getAttachmentid
>       getFileName not getFilename
>
> Torque seems to lowercase all the names... Can this be avoided? Is there
> any easy way to do this by altering the velocity macros?
>
>
>
> John Menke
>
> ---------------------------------------------------------------------
> 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