Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-15-2007, 03:48 PM
Member
 
Join Date: Aug 2007
Posts: 1
cryss_tyna is on a distinguished road
How can I store an image to the database using hibernate
Hi! In my JSP page i have an upload form and i want to store the image from the form to the database(Oracle). I tried the following:

FormFile myFile = (FormFile)form.get("myFile");
byte[] fileData = myFile.getFileData();

I get the following exception:

org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'java.lang.String' to property 'myFile' of type 'org.apache.struts.upload.FormFile'
org.apache.struts.action.DynaActionForm.set(DynaAc tionForm.java:424)
org.apache.commons.beanutils.PropertyUtils.setSimp leProperty(PropertyUtils.java:1769)
org.apache.commons.beanutils.PropertyUtils.setNest edProperty(PropertyUtils.java:1684)
org.apache.commons.beanutils.PropertyUtils.setProp erty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty (BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(Be anUtils.java:808)
org.apache.struts.util.RequestUtils.populate(Reque stUtils.java:495)
org.apache.struts.action.RequestProcessor.processP opulate(RequestProcessor.java:798)
org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

Please help me with this!

Thank you very much
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
image insertion into database abhiN Database 3 06-06-2008 03:31 PM
Retriving image from database Java Tip Java Tips 0 02-09-2008 10:41 PM
Database connectivity in Jave struts with Hibernate sanjay_sharma77 Advanced Java 1 02-02-2008 10:41 PM
Hibernate 2.1.8 / Oracle 10 / Tomcat 5.0.28 : Data not retrieved from the database scastro Database 4 08-10-2007 12:41 AM
Hibernate with multiple database Marty Database 2 05-07-2007 06:56 PM


All times are GMT +3. The time now is 02:43 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org