Hi,
> -----Message d'origine-----
> De: Armin Waibel [mailto:[EMAIL PROTECTED]
> Date: mercredi, 5. novembre 2003 11:46
> �: OJB Users List
> Objet: Re: PB error when the browser is stoped
>
>
> Hi,
>
> [EMAIL PROTECTED] wrote:
>
> > Hello Armin,
> >
> > I'm using OJB 0.9.5.
> >
> uuh! a real oldtimer ;-)
>
> > The code is below.
> >
> > The "stop" button is pressed during the execution time of
> this method below.
> > I think that there something wrong because after I press
> "stop" and refresh the page, a
> TransactionNotInProgressException occured.
> >
> > Have you an idea?
> > Thanks
> > Sylvain
> >
> >
> > **code**
> > public void searchPerson(String lastName) {
> > Criteria crit = new Criteria();
> > crit.addLike("lastName", "%" + lastName + "%");
> > Query query = new QueryByCriteria(Person.class, crit);
> >
> > try {
> broker is a field in your class?
Yes it is.
> here you get a new instance, what about the
> previous referenced PB instance? Do multiple
> threads access class instance?
What do you mean?
Do you mean that if I declare only one class field (broker) I could have threads
problems?
> > broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> recommened to use
> PersistenceBroker pb = PersistenceBrokerFactory....
> in your methods
> > broker.beginTransaction();
> > Iterator iter = broker.getIteratorByQuery(query);
> >
> > while (iter.hasNext()) {
> > Person person = (Person) iter.next();
> > appResps.put(person.getPersonId(), person.getPersonName());
> > }
> >
> > broker.commitTransaction();
> > } catch (PersistenceBrokerException t) {
> > broker.abortTransaction();
> > t.printStackTrace();
> > } finally {
> > broker.close();
> > }
> >
> hmm, I'm not familiar with webserver internals, but think if
> you press 'stop' on the browser your method will be pass
> through anyway.
>
> StackTrace of the exception on refresh?
> Caused by 'broker.abortTransaction()'?
> If yes, I think it's a thread problem.
How could I test it?
Regards
Sylvain
>
> regards,
> Armin
>
> > }
> > **code**
> >
> >
> >>-----Message d'origine-----
> >>De: Armin Waibel [mailto:[EMAIL PROTECTED]
> >>Date: mercredi, 5. novembre 2003 10:22
> >>�: OJB Users List
> >>Objet: Re: PB error when the browser is stoped
> >>
> >>
> >>Hi Sylvain,
> >>
> >>[EMAIL PROTECTED] wrote:
> >>
> >>>Hello,
> >>>
> >>>I'using PB intances to retrieve info from my database.
> >>>When the time to search information is too long you can
> >>
> >>press the "stop" button on the browser.
> >>
> >>>But when I restart my application there is a
> >>
> >>TransactionNotInProgress exception.
> >>
> >>>Maybe the PB instance isn't closed when I stop the transaction!??
> >>>How could I close the PB intansce when I stop the browser?
> >>>How could I manage this?
> >>>Is someone has an experience?
> >>>
> >>
> >>Can you describe more detailed, some pseudo code?
> >>Which version do you use?
> >>
> >>regards,
> >>Armin
> >>
> >>
> >>>Thanks
> >>>Sylvain
> >>>
> >>>
> >>
> >>------------------------------------------------------------
> ---------
> >>
> >>>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]