How to handle BLOB and CLOB in olingo v2?

↘锁芯ラ 提交于 2020-07-10 10:26:25

问题


Here there is pseudocode about how to handle BLOB and CLOB in olingo jpa. I added the needed imports to the pseudocode:

package me;

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

import javax.sql.rowset.serial.SerialException;

import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;

public class OnDBWriteContent implements OnJPAWriteContent {

    @Override
    public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException {
        try {
            return new JDBCBlob(binaryData);
        } catch (SerialException e) {
            ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
        } catch (SQLException e) {
            ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
        }
        return null;
    }

    @Override
    public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException {
        try {
            return new JDBCClob(new String(characterData));
        } catch (SQLException e) {
            ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
        }
        return null;
    }
}

the only problem is I couldn't find any implementation for JDBCBlob and JDBCClob. Any suggestion about how can I implement them or use some classes?

来源:https://stackoverflow.com/questions/62813234/how-to-handle-blob-and-clob-in-olingo-v2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!