Monday, June 7, 2010

Calling Seam managed entity manager from a servlet

I've been spending a majority of my time for the past week trying to figure out what seemed like an unsolvable problem. Again, as usual, this is related to the PDF applications.

So, we have the following process flow in our system :
1) Users print the application, which is partially filled with data collected from the system.
2) Then, users can fill in more information (as government applications ask for very minute details of information).
3) Then, users can click 'Save' button provided on the form so that those additional filled data are being stored as fdf file on our server.

Now, users want to download those data files within a given date range. My original work flow didn't involve any database interaction. But now, I have to store data regarding each fdf file so that those data can be used in the download process. However, it requires a database interaction and we use Seam managed persistence context for persisting data in the database.

When the 'Save' button is clicked, before a fdf file is created on the database, it has to create a row in the table so that we know which day fdf file is created and other information. I'm stuck at this step since I can't get the existing entity manager in our application scope from a custom servlet call inside a pdf file.

I've been trying and today I made slight progress. I managed to obtain an entitymanager object from a servlet call. However, I still need to figure out how to do additional processing by using that entitymanager. I'll post the code if I succeed to do what I need to do.

No comments:

Post a Comment