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 15:50:19 GMT

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.


-----Original Message-----
From: Jeff Butler [mailto: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.

View raw message