Example usage for org.springframework.jdbc.support.lob LobHandler getClobAsString

List of usage examples for org.springframework.jdbc.support.lob LobHandler getClobAsString

Introduction

In this page you can find the example usage for org.springframework.jdbc.support.lob LobHandler getClobAsString.

Prototype

@Nullable
String getClobAsString(ResultSet rs, int columnIndex) throws SQLException;

Source Link

Document

Retrieve the given column as String from the given ResultSet.

Usage

From source file:org.sakaiproject.orm.ibatis.support.ClobStringTypeHandler.java

protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler) throws SQLException {
    return lobHandler.getClobAsString(rs, index);
}

From source file:org.apache.ctakes.ytex.uima.DBCollectionReader.java

protected void getDocumentById(final JCas aCAS, final Map<String, Object> id) {
    Map<String, Object> idMapTmp = id;
    if (this.isKeyNameToLowerCase()) {
        idMapTmp = new HashMap<String, Object>();
        for (Map.Entry<String, Object> e : id.entrySet()) {
            idMapTmp.put(e.getKey().toLowerCase(), e.getValue());
        }/*from www .j  a v  a  2 s .  co m*/
    }
    final Map<String, Object> idQuery = idMapTmp;
    this.txTemplate.execute(new TransactionCallback<Object>() {

        @Override
        public Object doInTransaction(TransactionStatus arg0) {
            namedJdbcTemplate.query(queryGetDocument, idQuery, new RowCallbackHandler() {
                boolean bFirstRowRead = false;

                @Override
                public void processRow(ResultSet rs) throws SQLException {
                    if (!bFirstRowRead) {
                        LobHandler lobHandler = new DefaultLobHandler();
                        String clobText = lobHandler.getClobAsString(rs, 1);
                        aCAS.setDocumentText(clobText);
                        bFirstRowRead = true;
                    } else {
                        log.error("Multiple documents for document key: " + idQuery);
                    }
                }
            });
            return null;
        }
    });
}