velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stevens <...@latchkey.com>
Subject Re: pull model design pattern question
Date Thu, 13 Sep 2001 01:15:56 GMT
on 9/12/01 5:25 PM, "Lane Sharman" <lane@san.rr.com> wrote:

> what about a method to provide the field list as well? does that exist?
> 
> -lane

Duh. Of course.

Here is an example of the generated code within Scarab's BaseWord.java class
(which represents a table called "SCARAB_WORD").

    /**
     * Generate a list of field names.
     */
    public static synchronized List getFieldNames()
    {
      if (fieldNames_ == null)
      {
        fieldNames_ = new Vector();
            fieldNames_.add("WordId");
            fieldNames_.add("Word");
            fieldNames_.add("Rating");
            fieldNames_.add("Ignored");
          }
      return fieldNames_;
    }

There are actually several methods to deal with this, including methods to
retrieve the data stored in the BO object based on field (ie: column) name.

Before you ask more questions about what Torque methods get generated, go
download Scarab, build it and take a look at the generated code. It gets
generated into:

scarab/target/webapps/scarab/WEB-INF/src/org/tigris/scarab/om

Lastly, Torque's generated Java code is based on the execution of Velocity
templates to output Java code. You can modify these yourself and add
whatever helpful methods you need to the Base objects.

thanks,

-jon


Mime
View raw message