You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ivan Bojer <ib...@gmail.com> on 2009/12/03 19:22:08 UTC

Where did my newline go????????

Hi folks,

I am going crazy with this and I would appreciate any help or hint!

Here is the sample:

RadiusServersDAO serversDao = new RadiusServersDAOImpl(sqlMapper);
RadiusServers aServer = getServerCraft()...

String endline = System.getProperty("line.separator");
String adminSecret = "aaa"; //$NON-NLS-1$
adminSecret += endline;
		
aServer.setAdminSecret(adminSecret);
serversDao.updateByPrimaryKey(aServer);

Once the update is done my 'admin_secret_ column contains entry which
is trimmed of the newline. I tried the same with pure JDBC and that
works.


Please help!!!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Where did my newline go????????

Posted by Clinton Begin <cl...@gmail.com>.
yes, iBATIS does trim newlines from the SQL statement itself.  If you're
using $substring$ replacement style parameters, they'll get trimmed. The
solution (and a safer way to code this) is to use JDBC #parameters#.

Clinton

On Thu, Dec 3, 2009 at 11:22 AM, Ivan Bojer <ib...@gmail.com> wrote:

> Hi folks,
>
> I am going crazy with this and I would appreciate any help or hint!
>
> Here is the sample:
>
> RadiusServersDAO serversDao = new RadiusServersDAOImpl(sqlMapper);
> RadiusServers aServer = getServerCraft()...
>
> String endline = System.getProperty("line.separator");
> String adminSecret = "aaa"; //$NON-NLS-1$
> adminSecret += endline;
>
> aServer.setAdminSecret(adminSecret);
> serversDao.updateByPrimaryKey(aServer);
>
> Once the update is done my 'admin_secret_ column contains entry which
> is trimmed of the newline. I tried the same with pure JDBC and that
> works.
>
>
> Please help!!!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>