You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Mathieu Frenette <ma...@freeborders.com> on 2002/04/15 16:43:44 UTC

TDK2.1's Object.vm screws up with BigDecimal

I had an object model generated by the decoupled Torque (an old version)
which was fine, but I just regenerated the om with tdk2.1 and it won't
compile.  BigDecimal fields are not initialized correctly.

Here are the two outputs...

>From tdk2.1 (erroneous) :
private BigDecimal field = 0;

>From my old Torque (fine) :
private BigDecimal field = new BigDecimal(0);

I compared the two Object.vm templates and decided to cut and paste a
section of the old template into the new one, and it fixed the problem.
Roughly, what I did is replace the #foreach for generating the fields by the
one from my old Torque.  It is obvious at first sight that the tdk's version
does not provide special treatment for BigDecimals, whereas my old torque
does.

Here's the comparison between the tdk's template, and my modified version
(sorry, but I don't have access to any diff tool on this machine, so I'll do
it manually) :

>From tdk2.1:
*********************************************************************
public abstract class $basePrefix$table.JavaName $extendsBaseClass
    implements Retrievable
{
#if (!$table.isAlias())

  #foreach ($col in $table.Columns)
    #set ( $cjtype = $col.JavaNative )
    #set ( $clo=$col.Name.toLowerCase() )
    #set ($defVal = "")
    #if ($col.DefaultValue && !$col.DefaultValue.equalsIgnoreCase("NULL") )
        #set ( $quote = '' )
        #if ( $cjtype == "String" )
            #set ( $quote = '"' )
        #end
        #set ( $defaultValue = $col.DefaultValue )
        #if ( $cjtype == "boolean" )
            #if ( $defaultValue == "1" || $defaultValue == "Y" )
                #set ( $defaultValue = "true" )
            #elseif ( $defaultValue == "0" || $defaultValue == "N" )
                #set ( $defaultValue = "false" )
            #end
        #end
        #set ($defVal = "=$quote$defaultValue$quote")
    #end
    /** the value for the $clo field */
    private $cjtype $clo$defVal;
  #end
*********************************************************************

My modified version:
*********************************************************************
public abstract class $basePrefix$table.JavaName $extendsBaseClass
    implements Retrievable
{
#if (!$table.isAlias())

      #foreach ($col in $table.Columns)
        #set ( $cjtype = $col.JavaNative )
        #set ( $clo=$col.Name.toLowerCase() )
        #set ($defVal = "")
        #if ($col.DefaultValue &&
!$col.DefaultValue.equalsIgnoreCase("NULL") )
          #set ( $quote = '' )
          #if ( $cjtype == "String" )
            #set ( $quote = '"' )
          #end
          #set ( $defaultValue = $col.DefaultValue )
          #if ( $cjtype == "boolean" || $cjtype == "Boolean" )
            #if ( $defaultValue == "1" || $defaultValue == "Y" )
              #set ( $defaultValue = "true" )
            #elseif ( $defaultValue == "0" || $defaultValue == "N" )
              #set ( $defaultValue = "false" )
            #end
          #end
          #if ($cjtype == "BigDecimal")
              #set ($defVal = "= new BigDecimal($defaultValue)")
          #elseif ($cjtype == "NumberKey")
              #set ( $quote = '"' )
              #set ($defVal = "= new NumberKey($quote$defaultValue$quote)")
          #elseif ($cjtype == "StringKey")
              #set ( $quote = '"' )
              #set ($defVal = "= new StringKey($quote$defaultValue$quote)")
          #else
              #if (!$col.isPrimitive() && $cjtype != "String")
                  #set ( $defaultValue = "new ${cjtype}($defaultValue)" )
              #end
              #set ($defVal = "=$quote$defaultValue$quote")
          #end
        #end

        /**
         * The value for the $clo field
         */
        private $cjtype $clo$defVal;
      #end
*********************************************************************

HTH...

-- Mathieu.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Error in project.xml

Posted by Jason van Zyl <jv...@zenplex.com>.
On Mon, 2002-04-15 at 15:35, Eric Pugh wrote:
> I see!  Maybe then a change could be made to non-distributable-jars.list to
> add a message, something like:
> 
> "Make sure that the activation.jar you download is named
> activation-1.0.1.jar"
> 
> so that other people don't run through the same difficulty.

Noted, added to the task list for the b4 release.
 
> Eric
> 
> -----Original Message-----
> From: Jason van Zyl [mailto:jvanzyl@zenplex.com]
> Sent: Monday, April 15, 2002 2:07 PM
> To: Turbine Developers List
> Subject: Re: Error in project.xml
> 
> 
> On Mon, 2002-04-15 at 14:17, Eric Pugh wrote:
> > Hi all,
> >
> > The project.xml file has an error.  The activiation jar when downloaded
> from
> > sun is just activation.jar.  Currently you have to rename the jar from
> > activation-1.0.1.jar to activation.jar to compile the code.  Here is the
> > diff:
> >
> > cvs -z9 diff project.xml (in directory C:\java\jakarta-turbine-2\)
> > Index: project.xml
> > ===================================================================
> > RCS file: /home/cvspublic/jakarta-turbine-2/project.xml,v
> > retrieving revision 1.28
> > diff -r1.28 project.xml
> > 368c368
> > <       <jar>activation-1.0.1.jar</jar>
> > ---
> > >       <jar>activation.jar</jar>
> >
> > *****CVS exited normally with code 1*****
> 
> Unfortunately you have to rename it. There is actually nothing that can
> be done in this particular case because not even the manifest inside the
> JAR states what version of the JAF we are actually dealing with. Thanks
> Sun!
> 
> We are trying to sort these nasty issues out on a larger scale but some
> manual fudging has to be done right now. The JAF is a particularly good
> example of bad process. Without the distribution you can't tell easily
> what version of the JAF you're dealing with.
> 
> > Eric Pugh
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> --
> jvz.
> 
> Jason van Zyl
> jvanzyl@apache.org
> 
> http://tambora.zenplex.org
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Error in project.xml

Posted by Eric Pugh <ep...@upstate.com>.
I see!  Maybe then a change could be made to non-distributable-jars.list to
add a message, something like:

"Make sure that the activation.jar you download is named
activation-1.0.1.jar"

so that other people don't run through the same difficulty.

Eric

-----Original Message-----
From: Jason van Zyl [mailto:jvanzyl@zenplex.com]
Sent: Monday, April 15, 2002 2:07 PM
To: Turbine Developers List
Subject: Re: Error in project.xml


On Mon, 2002-04-15 at 14:17, Eric Pugh wrote:
> Hi all,
>
> The project.xml file has an error.  The activiation jar when downloaded
from
> sun is just activation.jar.  Currently you have to rename the jar from
> activation-1.0.1.jar to activation.jar to compile the code.  Here is the
> diff:
>
> cvs -z9 diff project.xml (in directory C:\java\jakarta-turbine-2\)
> Index: project.xml
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-2/project.xml,v
> retrieving revision 1.28
> diff -r1.28 project.xml
> 368c368
> <       <jar>activation-1.0.1.jar</jar>
> ---
> >       <jar>activation.jar</jar>
>
> *****CVS exited normally with code 1*****

Unfortunately you have to rename it. There is actually nothing that can
be done in this particular case because not even the manifest inside the
JAR states what version of the JAF we are actually dealing with. Thanks
Sun!

We are trying to sort these nasty issues out on a larger scale but some
manual fudging has to be done right now. The JAF is a particularly good
example of bad process. Without the distribution you can't tell easily
what version of the JAF you're dealing with.

> Eric Pugh
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Error in project.xml

Posted by Jason van Zyl <jv...@zenplex.com>.
On Mon, 2002-04-15 at 14:17, Eric Pugh wrote:
> Hi all,
> 
> The project.xml file has an error.  The activiation jar when downloaded from
> sun is just activation.jar.  Currently you have to rename the jar from
> activation-1.0.1.jar to activation.jar to compile the code.  Here is the
> diff:
> 
> cvs -z9 diff project.xml (in directory C:\java\jakarta-turbine-2\)
> Index: project.xml
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-2/project.xml,v
> retrieving revision 1.28
> diff -r1.28 project.xml
> 368c368
> <       <jar>activation-1.0.1.jar</jar>
> ---
> >       <jar>activation.jar</jar>
> 
> *****CVS exited normally with code 1*****

Unfortunately you have to rename it. There is actually nothing that can
be done in this particular case because not even the manifest inside the
JAR states what version of the JAF we are actually dealing with. Thanks
Sun!

We are trying to sort these nasty issues out on a larger scale but some
manual fudging has to be done right now. The JAF is a particularly good
example of bad process. Without the distribution you can't tell easily
what version of the JAF you're dealing with.
 
> Eric Pugh
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Error in project.xml

Posted by Eric Pugh <ep...@upstate.com>.
Hi all,

The project.xml file has an error.  The activiation jar when downloaded from
sun is just activation.jar.  Currently you have to rename the jar from
activation-1.0.1.jar to activation.jar to compile the code.  Here is the
diff:

cvs -z9 diff project.xml (in directory C:\java\jakarta-turbine-2\)
Index: project.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-2/project.xml,v
retrieving revision 1.28
diff -r1.28 project.xml
368c368
<       <jar>activation-1.0.1.jar</jar>
---
>       <jar>activation.jar</jar>

*****CVS exited normally with code 1*****

Eric Pugh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>