Hi, there is no difference in intern handling between > PersistenceBroker broker = > PersistenceBrokerFactory.defaultPersistenceBroker(); and > PersistenceBroker broker = > PersistenceBrokerFactory.createPersistenceBroker(PBKey key) First method is a convenience method for the second one. If attribute default-connection="true" set in jdbc-connection-descriptor (with valid user/password) OJB build an intern PBKey used to fulfil first method call.
Second method is recommended when: - using more than on database/database user - you don't want to declare user/passwd in repository file If you only user one database and don't have a problem to declare user/passwd in repository file, then there is no reason to use convenience method. > > :) OJB turorial is not a best source for real applications . Currently Brain McCallister is refactoring the tuturial stuff to make things clearer. regards, Armin ----- Original Message ----- From: "Gustafson, Scott F." <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Wednesday, August 13, 2003 2:25 PM Subject: RE: Connection leak problem with OJB RC3 on Weblogic 7.0 SP2 > > Beware of: > PersistenceBroker broker = > PersistenceBrokerFactory.defaultPersistenceBroker(); > > I ran into some threading issues when using it, after I switched to: > PersistenceBroker broker = > PersistenceBrokerFactory.createPersistenceBroker(PBKey key) > > These problems went away, see an earlier thread "Threadsafety of the > PersistenceBroker default impl" > > > sg > > -----Original Message----- > > From: Alexander Prozor [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, August 13, 2003 8:15 AM > > To: OJB Users List > > Subject: Re: Connection leak problem with OJB RC3 on Weblogic 7.0 SP2 > > > > > > :) OJB turorial is not a best source for real applications . > > it's better to take a look to the unit tests code. as you can > > see in all tests broker closed: > > PersistenceBroker broker = > > PersistenceBrokerFactory.defaultPersistenceBroker(); > > try > > { > > .... > > } > > finally > > { > > if (broker != null) broker.close(); > > } > > > > > > >Nope, actually I don't call the broker.close() method. Is it > > necessary? > > >The example code didn't do that either and the JavaDoc says > > about the > > >close() > > >method: > > >"Close this PersistenceBroker so that no further requests > > may be made on it. > > >A PersistenceBroker instance can be used only until it is > > closed. Closing a > > >PersistenceBroker might release it to the pool of available > > >PersistenceBrokers, or might be garbage collected, at the > > option of the > > >implementation. " > > >So it might release the broker instance to the pool, not the > > connection. Or > > >does it automatically closes the underlying Connection object? > > > > > >I'll give a try anyway. > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > 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]