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:[EMAIL PROTECTED] ]
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 <[EMAIL PROTECTED]> 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.
>
>
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 <[EMAIL PROTECTED]> wrote:
- Re: Abator / oracle pb with CHAR columns Jeff Butler
- RE: Abator / oracle pb with CHAR columns Chris Lamey
- Re: Abator / oracle pb with CHAR columns Larry Meadors
- RE: Abator / oracle pb with CHAR columns Chen, Tim