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

Need advice on building a new eCommerce web (cloud) based system from scratch.

database design web-applications architecture

I was planning to develop an ecommerce website which might take me 8 months-12 months (I work on this project part time) to build the prototype. I haven’t decided yet if I can do that alone or wit...

Does std::function() check the type when compiling code in C++11 in VS2010?

c++ c++11 typechecking std-function

I am using std::function() in my code with C++11 and VS2010. Here is my code.

Suggestions about Lightweight Open Source Web Servers which can support Web Services written in Java

java web-services open-source java-ee webserver

I am currently looking for Lightweight open source web servers which can support Web Services written in Java.

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.