/**
 *
 * Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); You may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.speedment.runtime.config.mapper.largeobject;

import com.speedment.runtime.annotation.Api;
import com.speedment.runtime.config.mapper.TypeMapper;
import com.speedment.runtime.exception.SpeedmentException;

import java.sql.Clob;
import java.sql.SQLException;

/**
 *
 * @author Per Minborg
 */
@Api(version = "3.0")
public class ClobToStringMapper implements TypeMapper<Clob, String> {

    @Override
    public Class<String> getJavaType() {
        return String.class;
    }

    @Override
    public Class<Clob> getDatabaseType() {
        return Clob.class;
    }

    @Override
    public String toJavaType(Clob value) {
        if (value == null) {
            return null;
        }
        try {
            if (value.length() < Integer.MAX_VALUE) {
                return value.getSubString(1, (int) value.length());
            }
            throw new SpeedmentException("The provided Clob contains too many characters >" + Integer.MAX_VALUE);
//            final StringBuilder sb = new StringBuilder();
//            try (BufferedReader br = new BufferedReader(value.getCharacterStream())) {
//            
//            }
//            return sb.toString();
        } catch (SQLException sqle) {
            throw new SpeedmentException("Unable to convert Clob to String.", sqle);
        }
    }

    @Override
    public Clob toDatabaseType(String value) {
        if (value == null) {
            return null;
        }
        return new StringClob(value);
    }

    @Override
    public boolean isIdentityMapper() {
        return false;
    }
}

@@ -1324,24 +1324,21 @@
        %7D
-%0A       
+ else
  try %7B%0A 
@@ -1463,33 +1463,44 @@
 );%0A            %7D
-%0A
+ else %7B%0A    
             thro
@@ -1524,16 +1524,37 @@
 ception(
+%0A                    
 %22The pro
@@ -1615,21 +1615,17 @@
 AX_VALUE
-);%0A//
+%0A
         
@@ -1632,209 +1632,28 @@
     
-final StringBuilder sb = new StringBuilder();%0A//            try (BufferedReader br = new BufferedReader(value.getCharacterStream())) %7B%0A//            %0A//            %7D%0A//            return sb.toString();
+    );%0A            %7D
 %0A   
@@ -1666,16 +1666,22 @@
  catch (
+final 
 SQLExcep

Fix some formatting