Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA on Tomcat 5.5

 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm now getting JPA work on Tomcat 5.5 and it seems now that everything works fine.

For making it working fine I have defined an attribute on request scope in which I have defined some custom entitymanager by using the decorator pattern. In this I've defined a filter which will close the entitymanager if it exists on request scope and set the attribute explicit to null.

The reason of choosing this solution is that in the near future I will upgrade my applications to a complete J2EE-server and a filter can easily be removed.

By the way I had to use a entitymanager on requestscope and not on business method scope because of lazy loading. There was an error message in my application.

If have learnt that request attributes are inherently thread save so that's not a problem, but is a filter a good solution.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic