Blobs in MyBatis

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Blobs in MyBatis

Jan Žanda
Hi, I have problem with blobs.

I have PLSQL procedure, that has IN and OUT blob params.
When I call it, no exception is thrown, but no output either :( And
since the procedure works fine (tested on pure JDBC), I can't find the

Mapping XML:

        <resultMap type="cz.trask.pokus.bloby.Wrapper" id="wrap">
                <result property="values" column="B_BLOB" />

        <select id="getBlob" statementType="CALLABLE">
                #{bBlob,mode=OUT,jdbcType=BLOB, resultMap=wrap}

Wrapper Java object:

public class Wrapper {

        private byte[] values;

        public byte[] getValues() {
                return values;

        public void setValues(byte[] values) {
                this.values = values;



public interface GetBlobByBlob {
        public Object getBlob(@Param("aBlob") Object in, @Param("bBlob")
Wrapper out);

Example of usage:

  byte[] inn = new byte[] { 99, 22, 34 };
  Wrapper wrap = new Wrapper();

  GetBlobByBlob mapper = session.getMapper(GetBlobByBlob.class);
  mapper.getBlob(inn, wrap);

What do I do wrong?