sounds good. I was thinking something along those lines of indirection. --Alen
----- Original Message ----- From: "Michael Thompson" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, June 20, 2003 4:24 PM Subject: Re: How much should Struts be aware of my persistence system > Ahhhh, didn't quite catch that. I don't know that I'd be putting that > kind of knowledge(OJB) in my struts actions. I'd probably wrap that up > behind some interface. > > public interface FooManager > { > public Collection getFoos() > throws SomeKindOfPersistenceExcpetion; > } > > Struts Action would grab and instance of FooManager (JNDI, Factory, > singletons, whatever) and call getFoos(). > > getFoos implementation would do all OJB specific stuff. > > Right/Wrong whatever... just my $0.02... > > --m > > > Alen Ribic wrote: > > Hi Michael > > > > Thanks for your response. > > > > Do you mean a global object reference that will be shared by all user > > invocations? > > If so, that will not work in my case because I need a new instance for each > > separate action method invocation. > > That's suppose to be best practice for when using OJB persistence system. > > > > OJB-user list question from me... > > <snippet> > > > >>Where do you suggest for the instantiation of Persistence > >>Broker to reside? > > > > For maximum scalability try to keep instantiation and closing of a broker > > instance as close together as possible. best thing is to open a broker at > > the beginning of a command and to close it at the end (in a finally block to > > make sure it really is called!) > > </snippet> > > > > --Alen > > > > > > > > ----- Original Message ----- > > From: "Michael Thompson" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Friday, June 20, 2003 3:59 PM > > Subject: Re: How much should Struts be aware of my persistence system > > > > > > > >>I've done stuff like this in a javax.servlet.ServletContextListener. > >> > >>the contextInitialized method gets called when the app is ready to > >>recieve reqs, so initialization of "global" objects can be done there. > >> > >>There may be a way to do it in a more struts like fashion... > >>--m > >> > >> > >>Alen Ribic wrote: > >> > >>>Hi all > >>> > >>>Where do you think is the best place to initialise your persistence, > >> > > ORM, > > > >>>system in Struts? > >>>Action classes, etc.? > >>>I would like to make the Struts framework least aware of my Persistence > >>>system. > >>> > >>>I'm using OJB with PB API and Struts 1.1. > >>> > >>>Apparently, best practice, when using OJB PB API is to create an > >> > > instance of > > > >>>Broker before executing business command and then close the Broker after > >>>execution. > >>> > >>> > >>>Any ideas as to what particular design I should implement here to get > >> > > most > > > >>>out of role separation? > >>> > >>>--Alen > >>> > >>> > >>> > >>>--------------------------------------------------------------------- > >>>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]