Quantcast

mybatis and blobs

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

mybatis and blobs

Slawek
Hello,

I'm going to read and save binarny files to database via mybatis. I
was looking but unfotrunely I can't find any examples how to do it. My
database is sqlserver - but it's not most important.

Best regards
sw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mybatis and blobs

Benoît
Hi Slawek,

Based on the default TypeHandler registered in MyBatis for BLOBs, I
would guess your mapped class would need a byte[] property:
class MyObject {
public byte[] getValue(){}
public void setValue(byte[]){}
}

Cheers,
Benoît

On Mar 3, 10:47 pm, Slawek <[hidden email]> wrote:
> Hello,
>
> I'm going to read and save binarny files to database via mybatis. I
> was looking but unfotrunely I can't find any examples how to do it. My
> database is sqlserver - but it's not most important.
>
> Best regards
> sw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mybatis and blobs

Kleczka Peter John
In reply to this post by Slawek
Hi

I have done this using byte[] for a web app with Spring handling the datasource. But found I could not open a file I had just uploaded unless I first logged out of the application.

On Mar 3, 2012, at 2:47 PM, Slawek <[hidden email]> wrote:

> Hello,
>
> I'm going to read and save binarny files to database via mybatis. I
> was looking but unfotrunely I can't find any examples how to do it. My
> database is sqlserver - but it's not most important.
>
> Best regards
> sw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mybatis and blobs

Larry Meadors
On Tue, Mar 6, 2012 at 6:56 AM, Kleczka Peter John <[hidden email]> wrote:
> I have done this using byte[] for a web app with Spring handling the datasource. But
> found I could not open a file I had just uploaded unless I first logged out of the application.

That sounds like a bug in your web app. I've done this plenty. It
works like a champ.

Larry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mybatis and blobs

ani_anirban@yahoo.com
This post has NOT been accepted by the mailing list yet.
In reply to this post by Kleczka Peter John
Please have a look here. I have compiled some code to store and retrieve a blob field.
Loading...