Thanks for the feedback Armin I am using OJB 0.9.2 (fairly old i know)
What is really happening is that when my oracle connection timesout or my session is killed by the dba i get a PersistenceBrokerSQLException. I then get another broker from the pool and retry but there is no way of forcing my PB to reconnect to the database. What happens on the retry is i get an java.sql.SQLException: ORA-01012: not logged on and then the autoinrement error occurs. From reading the code this occurs only becuase an Exception has occured during the key generation not because of any mapping issue. how do ypou guys handle such situations. Is there a way of cleaning up all of the connections and statements that have been pooled or is there a better approach? Perhap this bug has been fixed in the latest release 0.9.7? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, 10 October 2002 5:20 PM To: OJB Users List Subject: Re: OJB ERROR: Dont know how to autoincrement field Hi Shea, Which version of OJB did you use? There are some 'strange' method calls in your example. PBF has no 'createNewBrokerInstance' method. PBF.createPersistenceBroker(REPOSITORY_FILE) is now deprecated, better use PBF.defaultPersistenceBroker() (default PB using the repository declared in OJB.properties) or PBF.createPersistenceBroker(PBKey key) (for example see e.g. ...MultipleDBTest.java in the junit test dir) PB instances are pooled, thus obtain a PB instance from the PBF when necessary and !return! to pool when finished work. You do not need re-initialising the PB instance. OJB does intern check if a obtained connecion 'isClosed' true. e.g use the default PB try { broker = PBF.defaultPersistenceBroker(); broker.beginTransaction() // if autocommit is true it should work without // transaction declaration ... do something broker.commitTransaction() ... } catch(Exception e) { ...cleanup, rollback, .. } finally { if(broker != null) broker.close(); // returns the PB instance to pool } HTH, Armin ----- Original Message ----- From: "Shea Kelly" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Thursday, October 10, 2002 3:33 AM Subject: RE: OJB ERROR: Dont know how to autoincrement field > We were experiencing some problems with oracle connections timing out. As a > result the following code was added to re-initialise the broker > > public void initialiseBroker() > throws PersistenceException > { > if (myBroker != null) > { > theLog.info("Re-initialising OJB persistence broker instance"); > myBroker.close(); > myBroker = PersistenceBrokerFactory.createNewBrokerInstance(); > theLog.info("OJB persistence broker successfully > Re-initialised"); > } > } > > When we first create our broker we use > > PersistenceBrokerFactory.createPersistenceBroker(REPOSITORY_FILE); > > instead of PersistenceBrokerFactory.createNewBrokerInstance(); > > could this cause any problems? > > -----Original Message----- > From: Gareth Cronin [mailto:[EMAIL PROTECTED]] > Sent: Thursday, 10 October 2002 11:08 AM > To: 'OJB Users List' > Subject: RE: OJB ERROR: Dont know how to autoincrement field > > > No... all my persistent classes inherit from PersistentObject, which is not > defined in repository.xml - PersistentObject has a long "id" property that > is defined in all the subclasses in the repository and it works fine. > > > -----Original Message----- > > From: Shea Kelly [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, 10 October 2002 1:59 p.m. > > To: 'OJB Users List' > > Subject: RE: OJB ERROR: Dont know how to autoincrement field > > > > > > I all forgot to mention that all the objects i am storing > > inherit from the > > claim OjbObject which the exception is complaining about. > > However this is > > not defined in the repository.xml as a class-discriptor > > element. Could this > > cause a problem. All the stored subclasses are defined and > > the appropriate > > field myID is defined? > > > > -----Original Message----- > > From: Gareth Cronin [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, 10 October 2002 10:55 AM > > To: 'OJB Users List' > > Subject: RE: OJB ERROR: Dont know how to autoincrement field > > > > > > I've found that that particular exception gets raised for all > > manner of > > reasons... the actual reason for the error is usually further > > down the stack > > trace - I've had it occur when: > > -classes from different versions of OJB are mixed up together > > -the wrong type of object for a property is specified in > > repository.xml > > -the wrong version of repository.xml is being used > > > > > -----Original Message----- > > > From: Shea Kelly [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, 10 October 2002 1:45 p.m. > > > To: OJB Users (E-mail) > > > Subject: OJB ERROR: Dont know how to autoincrement field > > > > > > > > > Hi all, > > > > > > I am having a problem when I am trying to store object into > > > the database > > > calling store() on the persistent broker. Here is the the resulting > > > exception > > > > > > <2002-10-09 14:18:30,107> <HttpProcessor[8082][4]> <ERROR> <DEFAULT> > > > <10.32.4.179|FDEA434D27E2BB84E4B95362713E38DD> > > > <java.lang.RuntimeException: > > > OJB ERROR: Dont know how to autoincrement field class > > > au.com.vodafone.sid.model.OjbObject.myID> > > > <2002-10-09 14:18:30,122> <HttpProcessor[8082][4]> <ERROR> > > > <OjbBrokerManager> > > > <10.32.4.179|FDEA434D27E2BB84E4B95362713E38DD> <Error > > > while storing handset in the database: OJB ERROR: Dont know how to > > > autoincrement field class au.com.vodafone.sid.model.OjbObject.myID> > > > <2002-10-09 14:18:30,122> <HttpProcessor[8082][4]> <ERROR> > > > <OjbBrokerManager> <10.32.4.179|FDEA434D27E2BB84E4B95362713E38DD> > > > <org.apache.ojb.broker.metadata.ClassNotPersistenceCapableExce > > > ption: OJB > > > ERROR: Dont know how to autoincrement field class > > > au.com.vodafone.sid.model.OjbObject.myID > > > at org.apache.ojb.broker.Identity.<init>(Identity.java:157) > > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(Per > > > sistenceBroker > > > Impl.java:388) > > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(Per > > > sistenceBroker > > > Impl.java:352) > > > > > > I am using ojb version 0.9.2. I have searched through the > > > message boards and > > > read a number fo related entries. Alot of them seem to point > > > to the how the > > > broker is being used however what i have works, and has > > > worked well for a > > > number of months on our production server. > > > > > > The weird thing about it is I can store thing fine, but then > > > after what > > > seems to be a random amount of usage all attempts to store > > > object result in > > > the exception. I am using the SequenceManagerHighLowImpl. I > > > have 2 theories, > > > perhaps there is a problem with the sequence numbers in the > > > OJB_HL_SEQ table > > > (but it works to start with?). My second is that somehow the > > > persistent > > > broker doesn't know about the mapping? > > > > > > Has anyone else experienced this or know what the problem may be? > > > > > > try > > > { > > > getBroker().beginTransaction(); > > > storeObject(claim); > > > getBroker().commitTransaction(); > > > } > > > catch(OptimisticLockException ole) > > > { > > > getBroker().abortTransaction(); > > > handleOptimisticLockException("Error while > > > storing claim in the > > > database", ole, claim); > > > } > > > catch (PersistenceBrokerException e) > > > { > > > getBroker().abortTransaction(); > > > handleOjbException("Error while storing claim in > > > the database", > > > e); > > > } > > > finally > > > { > > > releaseBroker(); > > > } > > > > > > cheers > > > > > > Shea Kelly > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
