Thread:
 linebreaks disapears in nullSafeGet 
 Kai   12 Mar 2004, 09:19 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: Kai (12 Mar 2004, 09:19) Replies: 0, Views: 39449
Subject: linebreaks disapears in nullSafeGet
Hi,

if you have stored "First line\nSecond line" nullSafeGet will 
return "First lineSecond line". 
The simple solution would be to add a "\n" after each line expected 
the last one.
However what you are thinking about this solution:
  public Object nullSafeGet(ResultSet rs, String[] names, Object 
owner) throws HibernateException, SQLException {
    Clob clob = rs.getClob(names[0]);
    if(clob == null) {
      return null;
    }
    return clob.getSubString(1, (int) clob.length());
  }

This also works fine for more than 4000 characters and null values.

Bye
Kai
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]