title: Spring Framework NString not supported
body: <p>I have an object named "Duuni" with some abstract getter and setter methods inside and "DuuniImpl" implementation of Duuni. I use JdbcTemplate and RowMapper to retreive data from database. Here's my code:</p>
  
  <pre><code>package vjb.de.vietjob.bean;
  
  import java.util.Date;
  
  public interface Duuni {
  
      public abstract int getId();
      public abstract void setId(int id);
  
      public abstract String getNimi();
      public abstract void setNimi(String nimi);
  
      public abstract Date getPaiva();
      public abstract void setPaiva(Date paiva);
  
      public abstract String getTiedot();
      public abstract void setTiedot(String tiedot);
  
      public abstract String getPaikka();
      public abstract void setPaikka(String paikka);
  
      public abstract String getPalkka();
      public abstract void setPalkka(String palkka);
  
  
  
  }
  </code></pre>
  
  <p>And DuuniImpl class:</p>
  
  <pre><code>package vjb.de.vietjob.bean;
  
  import java.text.SimpleDateFormat;
  import java.util.Date;
  
  public class DuuniImpl implements Duuni {
      SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd");
  
      private int id;
      private String nimi;
      private Date paiva;
      private String tiedot;
      private String paikka;
      private String palkka;
  
  
      public int getId() {
          return this.id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getNimi() {
          return this.nimi;
      }
  
      public void setNimi(String nimi) {
          this.nimi = nimi;
      }
  
      public Date getPaiva() {
          return paiva;
      }
  
      public void setPaiva(Date paiva) {
          this.paiva = paiva;
      }
  
      public String getTiedot() {
          return this.tiedot;
      }
  
      public void setTiedot(String tiedot) {
          this.tiedot = tiedot;
      }
  
      public String getPaikka() {
          return this.paikka;
      }
  
      public void setPaikka(String paikka) {
          this.paikka = paikka;
      }
  
      public String getPalkka() {
          return this.palkka;
      }
  
      public void setPalkka(String palkka) {
          this.palkka = palkka;
      }
  
      @Override
      public String toString() {
          return "duuniIplm [id=" + id + ", nimi=" + nimi + ", paiva=" + paiva
                  + ", tiedot=" + tiedot + ", paikka=" + paikka + ", palkka="
                  + palkka + "]";
      }
  
  
  }
  </code></pre>
  
  <p>DuuniDaoImpl class:</p>
  
  <pre><code>package vjb.de.vietjob.dao;
  
  import java.util.List;
  
  import javax.inject.Inject;
  
  import org.springframework.jdbc.core.JdbcTemplate;
  import org.springframework.jdbc.core.RowMapper;
  import org.springframework.stereotype.Repository;
  
  import vjb.de.vietjob.bean.Duuni;
  
  
  
  @Repository
  public class DuuniDaoImpl implements DuuniDao {
  
      @Inject
      private JdbcTemplate jdbcTemplate;
  
      public JdbcTemplate getJdbcTemplate(){
          return jdbcTemplate;
      }
  
      public void setJdbcTemplate(JdbcTemplate jdbcTemplate){
          this.jdbcTemplate=jdbcTemplate;
      }
  
  
  
      public List&lt;Duuni&gt; showDuuni() {
          String sql = "select * from duuni";
          RowMapper&lt;Duuni&gt; duuniRM = new DuuniRowMapper();
          List&lt;Duuni&gt; list = jdbcTemplate.query(sql, duuniRM);
          return list;
      }
  
      public void postDuuni(Duuni duuni) {
          // TODO Auto-generated method stub
  
      }
  
      public void deleteDuuni(int id) {
          // TODO Auto-generated method stub
  
      }
  
      public void postDuuni() {
          // TODO Auto-generated method stub
  
      }
  
  }
  </code></pre>
  
  <p>DuuniRowMapper class:</p>
  
  <pre><code>package vjb.de.vietjob.dao;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  
  import org.springframework.jdbc.core.RowMapper;
  
  import vjb.de.vietjob.bean.*;
  public class DuuniRowMapper implements RowMapper&lt;Duuni&gt; {
  
      public Duuni mapRow(ResultSet rs, int row) throws SQLException {
          Duuni duuni = new DuuniImpl();
          duuni.setId(rs.getInt("id"));
          duuni.setNimi(rs.getString("nimi"));
          duuni.setPaikka(rs.getString("paikka"));
          duuni.setPaiva(rs.getDate("paiva"));
          duuni.setPalkka(rs.getString("palkka"));
          duuni.setTiedot(rs.getNString("tiedot"));
  
          return duuni;
      }
  
  }
  </code></pre>
  
  <p>And finally the application to handle data from database:</p>
  
  <pre><code>package vjb.de.vietjob.dao;
  
  import java.util.List;
  
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  import vjb.de.vietjob.bean.Duuni;
  
  public class test {
  
      public static void main(String[] args) {
          ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("vietjob-data.xml");
          DuuniDao dao = (DuuniDao) context.getBean("duuniDao");
          List&lt;Duuni&gt; d = dao.showDuuni();
          for(Duuni duuni : d){
          System.out.println(duuni.getNimi());
          }
          context.close();
  
      }
  
  }
  </code></pre>
  
  <p>But when I'm runnig it, the error comes with "NString not supportted":</p>
  
  <pre><code>0    [main] INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@504bae78: startup date [Mon Mar 07 17:25:45 EET 2016]; root of context hierarchy
  60   [main] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [vietjob-data.xml]
  385  [main] INFO  org.springframework.context.support.PropertySourcesPlaceholderConfigurer  - Loading properties file from URL [file:/Volumes/Data/JavaEE/workspace/vietjob/target/classes/db_connection.properties]
  635  [main] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
  719  [main] INFO  org.springframework.jdbc.support.SQLErrorCodesFactory  - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
  Exception in thread "main" org.springframework.dao.InvalidDataAccessApiUsageException: StatementCallback; SQL [select * from duuni]; NString not supported; nested exception is java.sql.SQLFeatureNotSupportedException: NString not supported
      at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:94)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:416)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:471)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:481)
      at vjb.de.vietjob.dao.DuuniDaoImpl.showDuuni(DuuniDaoImpl.java:35)
      at vjb.de.vietjob.dao.test.main(test.java:14)
  Caused by: java.sql.SQLFeatureNotSupportedException: NString not supported
      at org.mariadb.jdbc.internal.SQLExceptionMapper.getFeatureNotSupportedException(SQLExceptionMapper.java:165)
      at org.mariadb.jdbc.MySQLResultSet.getNString(MySQLResultSet.java:2679)
      at org.apache.commons.dbcp.DelegatingResultSet.getNString(DelegatingResultSet.java:802)
      at org.apache.commons.dbcp.DelegatingResultSet.getNString(DelegatingResultSet.java:802)
      at vjb.de.vietjob.dao.DuuniRowMapper.mapRow(DuuniRowMapper.java:17)
      at vjb.de.vietjob.dao.DuuniRowMapper.mapRow(DuuniRowMapper.java:1)
      at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
      at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60)
      at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:460)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:405)
      ... 4 more
  </code></pre>
  
  <p>I'm using MariaDB.</p>