When I run the " ojb-model " target, the source-code that is generated
mostly does not compile, unless I change it again like:
 initialize the boolean variables to true/false from the generated null
initializations.
 initialize the int variables to 0 instead of null
 import the Date class

I am not a committer so will need the dev groups help to review and
apply the patch.

So I would like to submit a patch that fixes a few things, though not
all of them.
The file is: src\templates\ojb\model\Object.vm

And the changes are:

import java.io.Serializable;
//addition begin (importing this by default even if not required)>>
import java.util.Date; 
// << end addition


// original statements that get patched >>
    #foreach ($col in $table.Columns)
    protected $col.JavaPrimitive $col.Name.toLowerCase() = null;
    #end
    
// patch begin (change the above three lines to the following segment>>

    #foreach ($col in $table.Columns)
      #set ( $cjtype = $col.JavaPrimitive )
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $defaultValue = "null" )
          #if ( $cjtype == "boolean")
             #set ( $defaultValue = "false" )
          #elseif ($cjtype == "int")
             #set ( $defaultValue = "0" )
          #end
    protected $cjtype $clo = $defaultValue;
    #end

// << end patch

Thanks,


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to