インポートしたオープン ソースを実行しようとしていますが、実行後に次のエラーが発生します。
The method nullSafeSet(PreparedStatement, Object, int, SessionImplementor) of type
BlobUserType must override or implement a supertype method
これは、実際には必要ないので何も付けなかった方法ですが、回避する必要があります。
@Override
protected void nullSafeSet(PreparedStatement ps, Object value , int index ,
SessionImplementor si) throws SQLException{}
クラスコードは次のとおりです。
package org.squashtest.csp.tm.internal.infrastructure.hibernate;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.HibernateException;
import org.springframework.jdbc.support.lob.LobCreator;
import org.springframework.jdbc.support.lob.LobHandler;
import org.springframework.orm.hibernate3.support.AbstractLobType;
import org.hibernate.engine.SessionImplementor;
public class BlobUserType extends AbstractLobType {
@Override
public int[] sqlTypes() {
return new int[] {Types.BLOB};
}
@Override
public Class<?> returnedClass() {
return InputStream.class;
}
@Override
protected Object nullSafeGetInternal(ResultSet rs, String[] names,
Object owner, LobHandler lobHandler) throws SQLException,
IOException, HibernateException {
return lobHandler.getBlobAsBinaryStream(rs, names[0]);
}
@Override
protected void nullSafeSetInternal(PreparedStatement ps, int index, Object
value, LobCreator lobCreator) throws SQLException,
IOException, HibernateException {
if (value != null) {
lobCreator.setBlobAsBinaryStream(ps, index, (InputStream) value,
-1);
}
else {
lobCreator.setBlobAsBytes(ps, index, null);
}
}
}