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.