You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Nicolas Belisle <to...@yahoo.ca> on 2003/06/25 15:55:22 UTC
JDBC Conversion Problem
Hi, please look at :
package org.apache.torque.task;
class TorqueJDBCTransformTask
330 if (defValue != null)
I would suggest the following to correct the last issue :
330 if (defValue != null && !defValue.equals(""))
Nicolas Belisle
Rafi Mohamed <Ra...@yahoo.com.au> wrote:
I have the same problem with SMALLINT (not null and no default value
defined) and a similar one with URL generating a new byte[]().
I modify the generated schema and make the code work, but I would prefer a
better solution.
- Rafi.
----- Original Message -----
From: "Nicolas Belisle"
To: "Turbine Torque Users List"
Sent: Tuesday, June 24, 2003 6:43 AM
Subject: JDBC Conversion Problem (MySQL)
> Hi there,
>
> (I'm using Mysql 4.1.0 alpha)
>
> MySQL uses TINYINT (1) to represents the BIT type. So when I use the jdbc
function of the generator to convert the database to XML schema I get an
annoying :
>
>
>
> which generates a more annoying :
>
> /**
> * The value for the checked field
> */
> private byte checked = ;
>
> I would be nice if the generator could convert it to boolean and give a
valid default value.
>
> Nicolas
>
>
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
---------------------------------
Post your free ad now! Yahoo! Canada Personals
Re: JDBC Conversion Problem
Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Henning P. Schmiedehausen" <hp...@intermeta.de> writes:
[I didn't write this]
> >> 330 if (defValue != null)
> >>
> >> I would suggest the following to correct the last issue :
> >>
> >> 330 if (defValue != null && !defValue.equals(""))
>
> I have a mental programming pattern which says
>
> String xxx ; xxx != null and !xxx.equals("") -> StringUtils.isNotEmpty(xxx)
I too like using StringUtils isEmpty()/isNotEmpty().
The interpretation of null vs. empty string may have different meaning
for generation of Java depending upon the Java type of the column,
which is why I thought template handling (perhaps via creation of a
method for use by the template) would be more appropriate.
--
Daniel Rall
Re: JDBC Conversion Problem
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Daniel Rall <dl...@finemaltcoding.com> writes:
>> 330 if (defValue != null)
>>
>> I would suggest the following to correct the last issue :
>>
>> 330 if (defValue != null && !defValue.equals(""))
I have a mental programming pattern which says
String xxx ; xxx != null and !xxx.equals("") -> StringUtils.isNotEmpty(xxx)
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
Re: JDBC Conversion Problem
Posted by Daniel Rall <dl...@finemaltcoding.com>.
I took a look, and it seems that this would be correctly handled in
the template referenced by Nicolas which was used to generate the Java
code.
- Dan
Nicolas Belisle <to...@yahoo.ca> writes:
> Hi, please look at :
>
> package org.apache.torque.task;
> class TorqueJDBCTransformTask
>
> 330 if (defValue != null)
>
> I would suggest the following to correct the last issue :
>
> 330 if (defValue != null && !defValue.equals(""))
>
> Nicolas Belisle
>
>
> Rafi Mohamed <Ra...@yahoo.com.au> wrote:
>
> I have the same problem with SMALLINT (not null and no default value
> defined) and a similar one with URL generating a new byte[]().
> I modify the generated schema and make the code work, but I would prefer a
> better solution.
>
> - Rafi.
>
> ----- Original Message -----
> From: "Nicolas Belisle"
> To: "Turbine Torque Users List"
> Sent: Tuesday, June 24, 2003 6:43 AM
> Subject: JDBC Conversion Problem (MySQL)
>
>
> > Hi there,
> >
> > (I'm using Mysql 4.1.0 alpha)
> >
> > MySQL uses TINYINT (1) to represents the BIT type. So when I use the jdbc
> function of the generator to convert the database to XML schema I get an
> annoying :
> >
> >
> >
> > which generates a more annoying :
> >
> > /**
> > * The value for the checked field
> > */
> > private byte checked = ;
> >
> > I would be nice if the generator could convert it to boolean and give a
> valid default value.
> >
> > Nicolas
> >
> >
> >
> >
> > ---------------------------------
> > Post your free ad now! Yahoo! Canada Personals
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
--
Daniel Rall