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
getorg.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl.getLastInsert(
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.afterStore(UnkUnknown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokernown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImplImpl.java:1985)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java:1891)
at
.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]
