db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Compilation errors in Torque generated Base classes
Date Thu, 13 Mar 2008 13:39:29 GMT
Hm, but it is a legal setting to have torque.objectIsCaching=false, so it
should produce workong code...

Would you mind to add an jira entry ?

    thanks,

          Thomas

"Paymer, Richard \(MSCIBARRA\)" <Richard.Paymer@mscibarra.com> schrieb am
12.03.2008 17:06:12:

> Answering my own question here.... This looks like a bug in the Torque
> code generator.
>
> It appears that it generates invalid Java files if the following
> property is set:
>
>   torque.objectIsCaching = false
>
> Setting that to true corrects the problem.
>
>
> -----Original Message-----
> From: Paymer, Richard (MSCIBARRA)
> Sent: Thursday, March 06, 2008 10:06 AM
> To: torque-user@db.apache.org
> Subject: Compilation errors in Torque generated Base classes
>
> I am new to Torque, so I may well be doing something wrong.
>
> Torque is consistently generating Base classes that won't compile for
> me.
>
> As an example, when I generate a table called Provider, I get a
> BaseProvider.java file.  It has the following bit of code in it:
>
>     /**
>      * A wrapper for getFields(new Criteria())
>      *
>      * @return the collection of associated objects
>      */
>     public List<Field> getFields()
>     {
>         return getFields(new Criteria(10));
>     }
>
>     /**
>      * If this Provider has previously
>      * been saved, it will retrieve related Fields from storage.
>      * If this Provider is new, it will return
>      * an empty collection or the current collection, the criteria
>      * is ignored on a new object.
>      *
>      * @throws TorqueException
>      */
>     public List<Field> getFields(Criteria criteria) throws
> TorqueException
>     {
>                 criteria.add(FieldPeer.PROVIDERID, getProviderid());
>                 return FieldPeer.doSelect(criteria);
>     }
>
> This doesn't compile because the getFields() method declaration doesn't
> indicate that it can throw a TorqueException.
>
> I am using the following build.properties:
>
>   torque.addGetByNameMethod = false
>   torque.addIntakeRetrievable = false
>   torque.addSaveMethod = true
>   torque.addTimeStamp = true
>   torque.basePrefix = Base
>   torque.complexObjectModel = true
>   torque.useClasspath = true
>   torque.useManagers = false
>   torque.objectIsCaching = false
>   torque.silentDbFetch = false
>   torque.generateBeans = false
>   torque.beanSuffix = Bean
>   torque.enableJava5Features = true
>
> And the Provider table declaration looks like this:
>
> <table name="Provider" idMethod="native"
>        description="Maps a ProviderName + ModelID to a ProviderID">
>     <column
>             name="ProviderID"
>             required="true"
>             primaryKey="true"
>             type="BIGINT"
>             description="ProviderID"/>
>     <column
>             name="ModelID"
>             required="true"
>             type="BIGINT"
>             description="ModelID"/>
>     <column
>             name="ProviderName"
>             required="true"
>             type="VARCHAR"
>             size="128"
>             description="ProviderName"/>
>     <foreign-key foreignTable="Model" onDelete="cascade">
>         <reference
>                 local="ModelID"
>                 foreign="ModelID"/>
>     </foreign-key>
>     <unique name="uxProvider_ModelID_Name">
>         <unique-column name="ModelID"/>
>         <unique-column name="ProviderName"/>
>     </unique>
>     <index name="ixProvider_ModelID_Name">
>         <index-column name="ModelID"/>
>         <index-column name="ProviderName"/>
>     </index>
> </table>
>
> The field table has a foreign key to the Provider table:
>
> <table name="Field" idMethod="native"
>        description="Maps a ProviderID + ModelID + FieldName +
> Granularity to a FieldID">
>     <column
>             name="FieldID"
>             required="true"
>             primaryKey="true"
>             type="BIGINT"
>             description="FieldID"/>
>     <column
>             name="ProviderID"
>             required="true"
>             type="BIGINT"
>             description="ProviderID"/>
>
>     <Other column definitions omittted... />
>
>     <foreign-key foreignTable="Provider" onDelete="cascade">
>         <reference
>                 local="ProviderID"
>                 foreign="ProviderID"/>
>     </foreign-key>
> </table>
>
> If I hand edit the generated code to add "throws TorqueException" in the
> appropriate places, the application seems to run fine.
>
> Am I doing anything obviously wrong?
> --------------------------------------------------------
>
> NOTICE: If received in error, please destroy and notify sender. Sender
does
> not intend to waive confidentiality or privilege. Use of this email is
> prohibited when received in error.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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


Mime
View raw message