Join an image into POJO on the server and then persisting using Hibernate?

in a question(here Placing an image in an object, sending the object over rpc and then using hibernate ), someone told me

  1. Capture non-binary fields (text) into the POJO. I.e. a form.
  2. Transfer the object using GWT RPC to the server.
  3. Upload image to server.
  4. Join the image into the POJO on the server.
  5. Save to database.

to be able to persist a file with hibernate.

I got an answer but I am not being able to know how to access the image on the server and join that with the hibernate object so that I can persist it on the database

Answers


There are two options:

  • store the file on disk and set its path in the entity

  • save the file in db (less preferable) in a blob. That would require setting a byte array in the entity

if you require more than one file per entity, you'd need a collection


Need Your Help

How can I remove 'no-cache=“Set-Cookie”' when I add a cookie to a HttpResponse?

asp.net .net wcf cookies

I'm currently returning a cookie from a web service with code like this:

Zend - Site Configuration Data

zend-framework

For my zend application I need to read from the database some basic configuration data which should be available everywhere. I would like to read them and save it to session so that I wouldn't have...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.