• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I am trying to generate a PDF file in Hibernate

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I am trying to generate a PDF file in Hibernate and want to to do similarly :

ServletOutputStream out = response.getOutputStream();
ByteArrayOutputStream.writeTo(out);
out.flush();


Can anyone Please help
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate has no support for PDF generation (its just an ORM tool). You need to use something else, for example iText.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the Prompt reply.

I downloaded the iText jar .

But i don't know how could i perform this type of operation using Hibernate



I want to construct a PDF dynamically by select a link from JSP Hibernate acting as a Model?? Any ideas??
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Paul said, Hibernate has nothing to do with PDFs; where do you think is the connection between the two?

And, since you mention JSPs, let me point out that you can't stream binary content (like a PDF) from a JSP - you need to use a servlet.

As to the code snippet you posted, what's the extra ByteArrayOutputStream for? Why not use the ServletOutputStream directly?
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:As Paul said, Hibernate has nothing to do with PDFs; where do you think is the connection between the two?



My plan is once i get the handle for the InputStream fro the Blob , i will be writing it to the pdfWriter using iText.


And, since you mention JSPs, let me point out that you can't stream binary content (like a PDF) from a JSP - you need to use a servlet.



I will be using Servlet only.


As to the code snippet you posted, what's the extra ByteArrayOutputStream for? Why not use the ServletOutputStream directly?



seems easier to work with iText API once i get the BinaryStream from a Blob
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a link which states that

In Hibernate2, Using Clobs/Blobs with Oracle and Hibernate :



Link
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your Blob store? What type of content is currently in the database?


(BTW: that link looks very out of date - it refers to Hibernate version 1.2.1 and Oracle 8 & 9 - neither of which are supported by Oracle anymore. You should also head the "beware" section at the end).
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul ,

Actually what i am trying to achive is to get the character data and construct an PDF file for every user related to his information.

But i can't understand where to start from including waht the variables should be in the User DTO.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Character data of what? From the request? From something already in the database?

Whatever its the source, this appears to be nothing to do with Hibernate. Since its more about PDF generation, I'll move it to a more appropriate forum.
 
Not so fast naughty spawn! I want you to know about
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic