If you have a schema like this.
<database>
(other tables of interest proceed this)
...
<!--
RESOURCE is a table of that contains any amount misc. information
for any number of tables. Each row in each table has a system-wide
unique primary key generated by using a custom IDBroker class.
Also provides a nice alternative to using OBJECTDATA BLOBs.
-->
<table name="RESOURCE" idMethod="idbroker">
<column name="RESOURCE_ID" javaName="Id" primaryKey="true" required="true"
type="VARCHAR" size="100"/>
<!--Unique indentifier to an object (row) in some other table -->
<column name="RES_REMOTE_ID" javaName="ResourceRemoteId" required="true"
type="VARCHAR" size="100"/>
<column name="REMOTE_OBJECT" required="true" type="VARCHAR" size="100"/>
<column name="RESOURCE_TYPE" javaName="Type" required="true" type="VARCHAR"
size="100"/>
<column name="RESOURCE_NAME" javaName="Name" required="true" type="VARCHAR"
size="75"/>
<column name="RESOURCE_URL" javaName="UrlString" required="false"
type="VARCHAR" size="100"/>
<column name="RESOURCE_TEXT" javaName="Text" required="false"
type="LONGVARCHAR"/>
<column name="RESOURCE_INT" javaName="Integer" required="false"
type="INTEGER"/>
<column name="RESOURCE_FLOAT" javaName="Float" required="false"
type="FLOAT"/>
<!--
DO NOT USE!!!
FK reference is here only to force RES_REMOTE_ID to be
created as StringKey instead of String in the om.
-->
<foreign-key foreignTable="RESOURCE">
<reference local="RES_REMOTE_ID" foreign="RESOURCE_ID"/>
</foreign-key>
</table>
<!--
These alias tables are created so that RESOURCES are part
of the related table's save() method and so they contain
get{AliasName}Resource and add{AliasName}Resource methods.
It is implied that the FKeys in following statements refer
to tables defined but not shown in this example.
-->
<table name="PRODUCT_RESOURCE"
alias="RESOURCE"
baseClass="Resource"
basePeer="ResourcePeer" >
<column name="RES_REMOTE_ID" javaName="ResourceRemoteId" required="true"
type="VARCHAR" size="100"/>
<foreign-key foreignTable="PRODUCT">
<reference local="RES_REMOTE_ID" foreign="PRODUCT_ID"/>
</foreign-key>
</table>
<table name="TABLE01_RESOURCE"
alias="RESOURCE"
baseClass="Resource"
basePeer="ResourcePeer" >
<column name="RES_REMOTE_ID" javaName="ResourceRemoteId" required="true"
type="VARCHAR" size="100"/>
<foreign-key foreignTable="TABLE01">
<reference local="RES_REMOTE_ID" foreign="TABLE01_ID"/>
</foreign-key>
</table>
</database>
When the om is generated, the peers for PRODUCT_RESOURCE and
TABLE01_RESOURCE have references this.res_remote_id in the om object and
mapBuilder in om peer. This will cause the compile to fail due to the fact
that res_remote_id and mapBuilder are private to the BaseResource and
BaseResourcePeer respectively. I have patched Object.vm and Peer.vm to use
the accessor methods instead of the instance variables.
Patch for Object.vm
start at line 266 ( I have left the original code intact but commented out
for readability)
## STW. Instead of using "this.\$col" use get\$column.JavaName()
#set ( $colAccessor= "get${column.JavaName}()")
#if ($cjtype == "int")
## #set ( $conditional = $strings.concat([$conditional, $and, "this.",
$clo, ">0"]) )
#set ( $conditional = $strings.concat([$conditional, $and, $colAccessor,
">0"]) )
#elseif ($cjtype == "long")
## #set ( $conditional = $strings.concat([$conditional, $and, "this.",
$clo, ">0"]) )
#set ( $conditional = $strings.concat([$conditional, $and, $colAccessor,
">0"]) )
#elseif ($cjtype == "short")
## #set ( $conditional = $strings.concat([$conditional, $and, "this.",
$clo, ">0"]) )
#set ( $conditional = $strings.concat([$conditional, $and, $colAccessor,
">0"]) )
#else
## #set ( $conditional = $strings.concat([$conditional, $and,
"!ObjectUtils.equals(this.", $clo, ", null)"]) )
#set ( $conditional = $strings.concat([$conditional, $and,
"!ObjectUtils.equals(", $colAccessor, ", null)"]) )
#end
## #set ( $arglist = $strings.concat([$arglist, $comma, "this.", $clo]) )
## STW. use accessor instead of private member
#set ( $arglist = $strings.concat([$arglist, $comma, $colAccessor]) )
Patch for Peer.vm
start at line 1037 ( I have left the original code intact but commented out
for readability)
#* STW. need to use getMapBuilder instead of this.mapBuilder to prevent
* to prevent peers that extend from the om object from failing
* due to mapBuilder not being visible because it is protected.
*#
## c.setDbName(mapBuilder.getDatabaseMap().getName());
c.setDbName(getMapBuilder().getDatabaseMap().getName());
Regards,
Scott
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>