Hi Armin I think I got it. There are three threads that tryed to insert the same data. I hat put the grabSize to one and that seemed to make troubles. I think, that the number using in grabSize has to be set to a number corresponding to the number of threads?
Thank you for your answer! Christian > -----Ursprungliche Nachricht----- > Von: Armin Waibel [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 8. Juni 2004 12:14 > An: OJB Users List > Betreff: Re: Can not init Identity for given object > > > Hi Christian, > > seems expected behaviour. SequenceManagerHighLowImpl use optimistic > locking to guarantee unique HighLowSequence objects. In current > implementation SequenceManagerHighLowImpl try five times to get next > sequence object. If all calls fails the last OptimisticLockingException > was thrown: > > > Caused by: > org.apache.ojb.broker.util.sequence.SequenceManagerException: > > Can't build new sequence > ... > > Caused by: org.apache.ojb.broker.OptimisticLockException: > Object has been > > modified by someone else > > How many threads try to insert the same data? > > regards, > Armin > > Christian Eugster wrote: > > Hi! > > > > I meet a problem using ojb 1.0rc5 and mysql (innodb): when i > try to insert > > an object with some children in a concurrent environment a > > ClassNotPersistenceCapableException is thrown if some other clients are > > doing the same (See the stacktrace below). > > > > What am I doing wrong? Has anybody experienced the same and > solved it (and: > > how)? > > > > Thank you for answering? > > > > Stacktrace: > > INFO: Beleg wird gespeichert... > > 08.06.2004 08:14:16 ch.eugster.pos.db.Table describeError > > SCHWERWIEGEND: Can not init Identity for given object > > [EMAIL PROTECTED] > > > org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException > : Can not > > init Identity for given > > object [EMAIL PROTECTED] > > at org.apache.ojb.broker.Identity.init(Unknown Source) > > at org.apache.ojb.broker.Identity.<init>(Unknown Source) > > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown > > Source) > > at > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollectionOb > ject(Unkno > > wn Source) > > at > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Unknown > > Source) > > at > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source) > > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown > > Source) > > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown > > Source) > > at > > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unkno > wn Source) > > at > > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unkno > wn Source) > > at ch.eugster.pos.db.Table.store(Table.java:119) > > at ch.eugster.pos.db.Table.store(Table.java:215) > > at > > > ch.eugster.pos.client.model.ReceiptModel.storeReceipt(ReceiptModel > .java:313) > > at > > > ch.eugster.pos.client.model.ReceiptModel.posEventPerformed(Receipt > Model.java > > :210) > > at > > ch.eugster.pos.client.event.Action.actionPerformed(Action.java:114) > > at > > > ch.eugster.pos.client.event.StoreReceiptAction.actionPerformed(Sto > reReceiptA > > ction.java:85 > > ) > > at > > > ch.eugster.pos.client.event.ExpressStoreReceiptAction.actionPerfor > med(Expres > > sStoreReceipt > > Action.java:99) > > at > javax.swing.AbstractButton.fireActionPerformed(Unknown Source) > > at > > javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown > > Source) > > at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown > > Source) > > at javax.swing.DefaultButtonModel.setPressed(Unknown Source) > > at > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown > > Source) > > at java.awt.Component.processMouseEvent(Unknown Source) > > at java.awt.Component.processEvent(Unknown Source) > > at java.awt.Container.processEvent(Unknown Source) > > at java.awt.Component.dispatchEventImpl(Unknown Source) > > at java.awt.Container.dispatchEventImpl(Unknown Source) > > at java.awt.Component.dispatchEvent(Unknown Source) > > at > java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) > > at > java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) > > at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) > > at java.awt.Container.dispatchEventImpl(Unknown Source) > > at java.awt.Window.dispatchEventImpl(Unknown Source) > > at java.awt.Component.dispatchEvent(Unknown Source) > > at java.awt.EventQueue.dispatchEvent(Unknown Source) > > at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown > > Source) > > at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown > > Source) > > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > > at java.awt.EventDispatchThread.run(Unknown Source) > > Caused by: org.apache.ojb.broker.PersistenceBrokerException: > Could not get > > key value > > at > > org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(Unknown > > Source) > > at > > > org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(Unknown Source) > > at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(Unknown > > Source) > > ... 40 more > > Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException: > > Can't build new sequence > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.get > Sequence(U > > nknown Source > > ) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.get > UniqueLong > > (Unknown Sour > > ce) > > at > > > org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUni > queValue(U > > nknown Source > > ) > > ... 43 more > > Caused by: org.apache.ojb.broker.OptimisticLockException: > Object has been > > modified by someone else > > at > > org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdate(Unknown > > Source) > > at > > > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source) > > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown > > Source) > > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown > > Source) > > at > > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unkno > wn Source) > > at > > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unkno > wn Source) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.loo > kupStoreSe > > quence(Unknow > > n Source) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.loo > kupStoreSe > > quence(Unknow > > n Source) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.loo > kupStoreSe > > quence(Unknow > > n Source) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.loo > kupStoreSe > > quence(Unknow > > n Source) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.loo > kupStoreSe > > quence(Unknow > > n Source) > > at > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.loo > kupStoreSe > > quence(Unknow > > n Source) > > ... 46 more > > > > > > the used classes are (class-descriptors) > > Receipt: > > <class-descriptor class="ch.eugster.pos.db.Receipt" table="pos_receipt" > > isolation-level="read-uncommitted" accept-locks="true" refresh="false"> > > <field-descriptor name="id" column="id" jdbc-type="BIGINT" > > primarykey="true" indexed="true" access="readwrite" autoincrement="true" > > nullable="true" locking="false" update-lock="true" > default-fetch="false" /> > > <field-descriptor name="timestamp" column="timestamp" > > jdbc-type="TIMESTAMP" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="number" column="number" indexed="true" > > jdbc-type="VARCHAR" length="25" primarykey="false" nullable="true" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="transactionId" column="transaction_id" > > jdbc-type="BIGINT" primarykey="false" indexed="true" access="readwrite" > > autoincrement="false" nullable="false" locking="false" > update-lock="true" > > default-fetch="false" /> > > <field-descriptor name="bookingId" column="booking_id" > > jdbc-type="BIGINT" primarykey="false" indexed="true" access="readwrite" > > autoincrement="false" nullable="false" locking="false" > update-lock="true" > > default-fetch="false" /> > > <field-descriptor name="salespointId" column="salespoint_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="userId" column="user_id" jdbc-type="BIGINT" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="foreignCurrencyId" > column="foreign_currency_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="status" column="status" jdbc-type="INTEGER" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="settlement" column="settlement" > > jdbc-type="BIGINT" primarykey="false" indexed="true" nullable="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="amount" column="amount" jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="payment" column="payment" jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="paymentFC" column="payment_fc" > > jdbc-type="DOUBLE" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > > > <reference-descriptor name="salespoint" > > class-ref="ch.eugster.pos.db.Salespoint" proxy="false" refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="salespointId" /> > > </reference-descriptor> > > > > <reference-descriptor name="user" class-ref="ch.eugster.pos.db.User" > > proxy="false" refresh="false" auto-retrieve="true" auto-update="false" > > auto-delete="false" otm-dependent="false"> > > <foreignkey field-ref="userId" /> > > </reference-descriptor> > > > > <reference-descriptor name="foreignCurrency" > > class-ref="ch.eugster.pos.db.ForeignCurrency" proxy="false" > refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="foreignCurrencyId" /> > > </reference-descriptor> > > > > <collection-descriptor name="positions" > > element-class-ref="ch.eugster.pos.db.Position" auto-retrieve="true" > > auto-update="true" auto-delete="true" sort="ASC" proxy="false" > > refresh="false" otm-dependent="false"> > > <orderby name="id" sort="ASC" /> > > <inverse-foreignkey field-ref="receiptId" /> > > </collection-descriptor> > > > > <collection-descriptor name="payments" > > element-class-ref="ch.eugster.pos.db.Payment" auto-retrieve="true" > > auto-update="true" auto-delete="true" sort="ASC" proxy="false" > > refresh="false" otm-dependent="false"> > > <orderby name="id" sort="ASC" /> > > <inverse-foreignkey field-ref="receiptId" /> > > </collection-descriptor> > > </class-descriptor> > > > > Position: > > <class-descriptor class="ch.eugster.pos.db.Position" > table="pos_position" > > isolation-level="read-uncommitted" accept-locks="true" refresh="false"> > > <field-descriptor name="id" column="id" jdbc-type="BIGINT" > > primarykey="true" indexed="true" access="readwrite" autoincrement="true" > > nullable="true" locking="false" update-lock="true" > default-fetch="false" /> > > <field-descriptor name="receiptId" column="receipt_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="productId" column="product_id" > > jdbc-type="VARCHAR" length="50" primarykey="false" nullable="true" > > indexed="false" autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="productGroupId" column="product_group_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="currentTaxId" column="current_tax_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="quantity" column="quantity" > jdbc-type="INTEGER" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="price" column="price" jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="discount" column="discount" > jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="expense" column="expense" jdbc-type="BIT" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="galileoBook" column="galileo_book" > > jdbc-type="BIT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="galileoBooked" column="galileo_booked" > > jdbc-type="BIT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="optCode" column="opt_code" jdbc-type="CHAR" > > length="1" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="author" column="author" jdbc-type="VARCHAR" > > length="100" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="title" column="title" jdbc-type="VARCHAR" > > length="100" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="publisher" column="publisher" > > jdbc-type="VARCHAR" length="100" primarykey="false" nullable="true" > > indexed="false" autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="isbn" column="isbn" jdbc-type="VARCHAR" > > length="13" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="bznr" column="bznr" jdbc-type="VARCHAR" > > length="10" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="productNumber" column="product_number" > > jdbc-type="VARCHAR" length="100" primarykey="false" nullable="true" > > indexed="false" autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="ordered" column="ordered" jdbc-type="BIT" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="orderId" column="order_id" > jdbc-type="VARCHAR" > > length="100" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > > > <reference-descriptor name="receipt" > > class-ref="ch.eugster.pos.db.Receipt" proxy="false" refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="receiptId" /> > > </reference-descriptor> > > > > <reference-descriptor name="productGroup" > > class-ref="ch.eugster.pos.db.ProductGroup" proxy="false" refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="productGroupId" /> > > </reference-descriptor> > > > > <reference-descriptor name="currentTax" > > class-ref="ch.eugster.pos.db.CurrentTax" proxy="false" refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="currentTaxId" /> > > </reference-descriptor> > > > > </class-descriptor> > > > > Payment: > > <class-descriptor class="ch.eugster.pos.db.Payment" table="pos_payment" > > isolation-level="read-uncommitted" accept-locks="true" refresh="false"> > > <field-descriptor name="id" column="id" jdbc-type="BIGINT" > > primarykey="true" indexed="true" access="readwrite" autoincrement="true" > > nullable="true" locking="false" update-lock="true" > default-fetch="false" /> > > <field-descriptor name="receiptId" column="receipt_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="paymentTypeId" column="payment_type_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="foreignCurrencyId" > column="foreign_currency_id" > > jdbc-type="BIGINT" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="quotation" column="quotation" > jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="amount" column="amount" jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="amountFC" column="amount_fc" > jdbc-type="DOUBLE" > > primarykey="false" nullable="true" indexed="false" autoincrement="false" > > locking="false" update-lock="true" default-fetch="false" > access="readwrite" > > /> > > <field-descriptor name="roundFactor" column="round_factor" > > jdbc-type="DOUBLE" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > <field-descriptor name="roundFactorFC" column="round_factor_fc" > > jdbc-type="DOUBLE" primarykey="false" nullable="true" indexed="false" > > autoincrement="false" locking="false" update-lock="true" > > default-fetch="false" access="readwrite" /> > > > > <reference-descriptor name="receipt" > > class-ref="ch.eugster.pos.db.Receipt" proxy="false" refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="receiptId" /> > > </reference-descriptor> > > > > <reference-descriptor name="paymentType" > > class-ref="ch.eugster.pos.db.PaymentType" proxy="false" refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="paymentTypeId" /> > > </reference-descriptor> > > > > <reference-descriptor name="foreignCurrency" > > class-ref="ch.eugster.pos.db.ForeignCurrency" proxy="false" > refresh="false" > > auto-retrieve="true" auto-update="false" auto-delete="false" > > otm-dependent="false"> > > <foreignkey field-ref="foreignCurrencyId" /> > > </reference-descriptor> > > > > </class-descriptor> > > > > > > --------------------------------------------------------------------- > > 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]