• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDO + J2EE best practice?

 
Greenhorn
Posts: 6
jQuery Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently im getting the PersistenceManagerFactory and PersistenceManager in a Filter and adding it to the request object. However, im not sure if this is the best way to set things up? The filter intercepts all requests.

I have two main concerns:

1 Im not sure if this method yields the best performance?

2 What if a POJO needs access to the PersistenceManager? Like a DAO

Looking forward to your responses.
Thanks
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for the short answer, but it may help

http://www.jdocentral.com/forums/index.php?&act=ST&f=11&t=625
 
Ben Thurley
Greenhorn
Posts: 6
jQuery Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Erik

As it happens i'd just stumbled upon a similar solution myself and was about to update this thread.

I use a Filter to intercept *.jsp requests and create a PersistenceManager for this request.



As you can see the Filter stores the PersistenceManager in a static class; PMRegistry. This is adapted from the somewhat lengthy article at TheServerSide



Now whenever I want to access the PersistenceManager I just make the call



This is the best I can come up with. Any comments good or bad would be welcome.
 
Erik Bengtson
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only comment I have is to put the pm.close in a try finally block, and make sure you are running a multi threaded enviroment



 
reply
    Bookmark Topic Watch Topic
  • New Topic