Hello i have a bug on rc5, i got the same in rc4 (see beelow) but whith some changes it has worked. I have try to put the same code in rc5 and i get the following error. I m a on sybase with rc5 and i use identity columns
rg.odmg.LockNotGrantedException: Can not lock [EMAIL PROTECTED] for WRITE at org.apache.ojb.odmg.TransactionImpl.lock(Unknown Source thanks remi ----- Original Message ----- From: "Rémi Bars" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Thursday, November 27, 2003 5:45 PM Subject: Re: Identity > ok thanks it works fine now > > Remi > > ----- Original Message ----- > From: "Armin Waibel" <[EMAIL PROTECTED]> > To: "OJB Users List" <[EMAIL PROTECTED]> > Sent: Thursday, November 27, 2003 5:31 PM > Subject: Re: Identity > > > > Hi, > > > > I think this is a bug in SequenceManagerNativeImpl. > > This should be fixed with current CVS. > > A workaround for rc4 could be a replacement of > > > > protected long getUniqueLong(FieldDescriptor field) throws > > SequenceManagerException > > { > > return -1; > > } > > > > with > > > > private long tempKey = -1; > > > > protected long getUniqueLong(FieldDescriptor field) throws > > SequenceManagerException > > { > > /* > > workaround for locking problems of new objects > > We need unique 'dummy keys' for new objects before storing > > */ > > return --tempKey; > > } > > > > We need a different temporary key for each requested > > key. This key will be replaced by the Identity value > > after the object was written to DB. > > > > HTH > > regards, > > Armin > > > > Rémi Bars wrote: > > > > > hi, > > > > > > i have try to put this in my code > > > > > > public String getLastInsertIdentityQuery(String tableName) > > > { > > > return "select @@identity"; (i need wait for an upgrade on > sybase > > > and test select last_insert_id() ) > > > } > > > > > > > > > > > > it works fine for the first record when i try to insert a second record > i > > > get : > > > > > > org.odmg.LockNotGrantedException: Can not lock > > > [EMAIL PROTECTED] for WRITE > > > > > > at org.apache.ojb.odmg.TransactionImpl.lock(TransactionImpl.java:279) > > > > > > what does it means? (sometimes it works.....when i m a on debugger) > > > > > > remi > > > > > > ----- Original Message ----- > > > From: "Rémi Bars" <[EMAIL PROTECTED]> > > > To: "OJB Users List" <[EMAIL PROTECTED]> > > > Sent: Thursday, November 27, 2003 10:02 AM > > > Subject: Re: Identity > > > > > > > > > > > >>i m using sybase > > >> > > >>where can i find the platformů implementation? > > >> > > >>----- Original Message ----- > > >>From: "Armin Waibel" <[EMAIL PROTECTED]> > > >>To: "OJB Users List" <[EMAIL PROTECTED]> > > >>Sent: Thursday, November 27, 2003 9:59 AM > > >>Subject: Re: Identity > > >> > > >> > > >> > > >>>which DB do you use? > > >>>the platform implementation class have to > > >>>override > > >>> > > >>>public String getLastInsertIdentityQuery(String tableName) > > >>>{ > > >>> // return the sql string to query last inserted Identity value > > >>>} > > >>> > > >>>regards, > > >>>Armin > > >>> > > >>>Rémi Bars wrote: > > >>> > > >>> > > >>>>hi, > > >>>> > > >>>>i have done the change and all my records are in the database. But now > > > > > > i > > > > > >>get > > >> > > >>>>this error : > > >>>> > > >>>>what does it mean? > > >>>> > > >>>>thanks ! > > >>>> > > >>>>remi > > >>>> > > >>>>org.apache.ojb.broker.util.sequence.SequenceManagerException: > > >>>>java.lang.UnsupportedOperationException: This feature is not supported > > >> > > >>by > > >> > > >>>>this implementation > > >>>> > > >>>> at > > >>>> > > >> > > > > org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl.getLastInsert( > > > > > >>>>Unknown Source) > > >>>> > > >>>> at > > >>>> > > >> > > > > org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl.afterStore(Unk > > > > > >>>>nown Source) > > >>>> > > >>>> at > > >>>> > > >> > > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker > > > > > >>>>Impl.java:1985) > > >>>> > > >>>> at > > >>>> > > >> > > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl > > > > > >>>>.java:1891) > > >>>> > > >>>> at > > >>>> > > >> > > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl > > > > > >>>>.java:1849) > > >>>> > > >>>> at > > > > > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown > > > > > >>>>Source) > > >>>> > > >>>> at > > > > > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown > > > > > >>>>Source) > > >>>> > > >>>> at org.apache.ojb.odmg.states.StateNewDirty.commit(Unknown Source) > > >>>> > > >>>> at org.apache.ojb.odmg.ObjectEnvelopeTable.commitAllEnvelopes(Unknown > > >>>>Source) > > >>>> > > >>>> at org.apache.ojb.odmg.ObjectEnvelopeTable.commit(Unknown Source) > > >>>> > > >>>> at org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(Unknown > > >> > > >>Source) > > >> > > >>>> at org.apache.ojb.odmg.TransactionImpl.prepare(Unknown Source) > > >>>> > > >>>> at org.apache.ojb.odmg.TransactionImpl.commit(Unknown Source) > > >>>> > > >>>> > > >>>>----- Original Message ----- > > >>>>From: "Armin Waibel" <[EMAIL PROTECTED]> > > >>>>To: "OJB Users List" <[EMAIL PROTECTED]> > > >>>>Sent: Wednesday, November 26, 2003 6:24 PM > > >>>>Subject: Re: Identity > > >>>> > > >>>> > > >>>> > > >>>> > > >>>>>doh! Seems I'm tired or dumb ;-) > > >>>>>I mean autoincrement="true" > > >>>>>Or did you implement your owm sequence manager? > > >>>>> > > >>>>>abashed, > > >>>>>Armin > > >>>>> > > >>>>>Armin Waibel wrote: > > >>>>> > > >>>>> > > >>>>> > > >>>>>>Hi, > > >>>>>> > > >>>>>>assume you are using SequenceManagerNativeImpl? > > >>>>>>Please set primarykey="true" > > >>>>>>Which OJB version? > > >>>>>> > > >>>>>>regards > > >>>>>>Armin > > >>>>>> > > >>>>>>Rémi Bars wrote: > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>>>Hi all, > > >>>>>>> > > >>>>>>>i m trying to use identity on sybase with the odmg api. I don t > > >>>>>>>understand > > >>>>>>>why only one object is insert in my table, when i try to add a > > > > > > second > > > > > >>>>>>>object > > >>>>>>>i get no error but no record too. > > >>>>>>> > > >>>>>>>have u an idea? > > >>>>>>> > > >>>>>>>thanks for ur help! > > >>>>>>> > > >>>>>>>here is my repository > > >>>>>>> > > >>>>>>><class-descriptor class='Structure' table='Structure' > > > >>>>>>> <field-descriptor > > >>>>>>> name="id" > > >>>>>>> column="id" > > >>>>>>> jdbc-type="numeric" > > >>>>>>> primarykey="true" > > >>>>>>> autoincrement="false" > > >>>>>>> access="readonly" > > >>>>>>> /> > > >>>>>>> <field-descriptor name='_Nom' column='nom' > > >>>>>>>jdbc-type='VARCHAR'/> > > >>>>>>></class-descriptor> > > >>>>>>> > > >>>>>>>here is my table > > >>>>>>>CREATE TABLE Structure ( > > >>>>>>> > > >>>>>>>id numeric(4,0) identity not null, > > >>>>>>> > > >>>>>>>nom VARCHAR(50) NULL ) > > >>>>>>> > > >>>>>>> > > >>> > > >>>>>--------------------------------------------------------------------- > > >>>>> > > >>>>>>>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] > > >>> > > >>> > > >> > > >> > > >>--------------------------------------------------------------------- > > >>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]