• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to convert blob to multipartfile in java

 
Sally william
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've stored the image to db as blob type. During uploading the image will be passed to DTO that has MultipartFile:

type to carry the image. My entity look like:

Then i convert the image dto attribute to blob in service side :

I need to display that image on my JSP page, and i need to set back all my entity attributes to DTO attributes.

Something like this:

I know i cannot simply set it to the DTO. Tried to google and find in forums..but could'nt find the correct way of doing it yet..

Please help..
 
priya uma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi thanks for your information...........
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sally william wrote:...Then i convert the image dto attribute to blob in service side:I need to display that image on my JSP page, and i need to set back all my entity attributes to DTO attributes...


I'm afraid I'm no expert on this stuff, but I don't see the setPicture() method that you appear to be trying to call (I do see setPictureFileName() though).

However, one tip that might help you out: Split your statements up into single actions.

That statement of yours above is doing at least 4 things that I can see (and maybe more under the hood), and it makes it very difficult to determine what's going wrong if you run into problems.

If you were to write:you would be accomplishing exactly the same thing (I think ), and you could then add debugging statements in between each stage to check that what you think is happening is in fact happening; and I think my first one would be to display picBytes.length.

In addition, it also makes it much easier for the next poor soul who has to maintain that program to understand what it's trying to do.

It's a really good mantra to learn - Write Dumb Code (←click).

HIH

Winston
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic