ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Lamey" <cla...@localmatters.com>
Subject RE: Abator / oracle pb with CHAR columns
Date Thu, 03 Aug 2006 16:12:49 GMT
Yea, seems like a good way to go to me.

Rather than changing the sqlmaps and putting in rpad everywhere (which if there's a schema
change, a re-gen and merge of the sqlmaps would be painful), folks could do something like:

   model.setProperty("        ");  // Same as size of DB field

On fields with no meaningful data before inserting the model.  I'd probably have a util class/method
that'd fill them all out via one method call, or maybe have a factory that handed out new
instances of the models with the properties all padded by default.

Or I'd change the schema to use VARCHAR:)

Cheers,
Chris

-----Original Message-----
From: Jeff Butler [mailto:jeffgbutler@gmail.com]
Sent: Thu 8/3/2006 10:02 AM
To: user-java@ibatis.apache.org
Subject: Re: Abator / oracle pb with CHAR columns
 
I agree.  The more I think about it, the less I like the idea of Abator
doing something automagically.  This could easily be validated and enforced
in some other layer of the application.

Certainly we wouldn't want to do anything like this by default.

Jeff Butler




On 8/3/06, Chris Lamey <clamey@localmatters.com> wrote:
>
>  Hello,
>
> Usually, CHARs indicate that you want the field filled out with something
> meaningful and so doing magic padding by default seems like a bad idea to
> me.  Most folks don't want to increase the size of their DB with useless
> data and CHAR forces space allocation.  Personally, I'd rather have the SQL
> fail if the model's property is null, generally that's accepted to be an
> indication a logic error somewhere (at least everywhere I've ever worked,
> except when you're trying to sneak something past the DBAs).
>
> I guess having an option to turn on CHAR padding would be useful in some
> corner cases, if it's off by default.  It might be nice if it could be at a
> per-column basis and/or a global one, but I think he wants global here.
>
> Cheers,
> Chris
>
>
> -----Original Message-----
> From: Jeff Butler [mailto:jeffgbutler@gmail.com <jeffgbutler@gmail.com>]
> Sent: Thu 8/3/2006 9:28 AM
> To: user-java@ibatis.apache.org
> Subject: Re: Abator / oracle pb with CHAR columns
>
> Well there's no understanding of DBA opinions sometimes :)
>
> In Java (brute force):
>
> if (value != null) {
>   StringBuffer sb = new StringBuffer(value);
>   while (sb.length() < 10) {
>     sb.append(' ');
>   }
>   value = sb.toString();
> }
>
> Since rpad is database specific, I don't think I should add it to Abator.
> But I suppose I could add code like the above to the domain object setter
> methods for CHAR fields - configurable with an option of course.  What do
> you think?
>
> Jeff Butler
>
>
>
>
>
> On 8/3/06, jeb001 <jeremy.jardin@gmail.com> wrote:
> >
> >
> > In order to be performant and light, my DBA prefers use CHAR type than
> > VARCHAR columns..
> >
> > So, I have to set that 'rpad' explicitly for each columns..
> >
> > Maybe Abator could set that 'rpad' for eahch Char column..
> >
> > I don't know how to set that in Java code, do you ?
> > --
> > View this message in context:
> >
> http://www.nabble.com/Abator---oracle-pb-with-CHAR-columns-tf2045970.html#a5634205
> > Sent from the iBATIS - User - Java forum at Nabble.com<http://nabble.com/>
> .
> >
> >
>
>


Mime
View raw message