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
problem.

Mapping XML:

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

        <select id="getBlob" statementType="CALLABLE">
                {call
                ODS_APPL_PKG.get_blob_by_blob(
                #{aBlob,mode=IN,jdbcType=BLOB},
                #{bBlob,mode=OUT,jdbcType=BLOB, resultMap=wrap}
                )}
    </select>


Wrapper Java object:


public class Wrapper {

        private byte[] values;

        public byte[] getValues() {
                return values;
        }

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

}


Interface:

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?

Thanks

Honza