db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Holcomb <w...@himinbi.org>
Subject [SOURCE] Issue #TRQS99 - Error setting default on foreign key
Date Wed, 18 Dec 2002 04:31:16 GMT
You can view the issue detail at the following URL:
<http://scarab.werken.com/scarab/issues/id/TRQS99>

Type :        Patch
Issue Id :    TRQS99
Reported by: Will Holcomb
             wholcomb - (will@himinbi.org)

Details:

Platform: PC
Operating system: Redhat
Summary: Error setting default on foreign key
Description: Object.vm includes the following code in the Object generation code when generating
the methods to set a foreign key reference:

#if($colFK.Primitive)
  #set ($coldefval = "0")
  #set ($coldefval = $column.DefaultValue)
  set${column.JavaName}($coldefval);
#else
  set${column.JavaName}(($column.JavaNative)null);
#end

The template is checking here if the column being referred to is represented by an object
and choosing how to set the default.

It is setting the default on the local column though, so the check should be whether the local
column is an object, not the reffered to column.

The bulk of this patch is a change to this:

#if($localCol.primitive)
  #set( $defaultValue = 0 )
  ## Velocity will not assign when the returned value is null
  #set( $defaultValue = $column.defaultValue )
  set${column.javaName}($defaultValue);
#else
  set${column.javaName}(($column.javaNative)null);
#end

There is also some variable renaming within the local code block to make the logic clearer.
(I did it while I was figuring out how it worked.)
Status: New
Priority: Medium
Vote: Medium


Mime
View raw message