This doesn't solve your immediate problem, but you can implement your own SequenceManager to generate DECIMAL ids.
Cheers, Charles. >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Sent: 21 March 2003 09:41 >To: [EMAIL PROTECTED] >Subject: RE: What happens when an insert with ODMG fails? > > >Hi Will, > >if an object has an ID (not null or zero) and the >ID exists still in the Database then ODMG do nothing >(also no update as you say). I made tests with OBJ 0.9.8. > >if the ID of an object is null then also ODMG do nothing. >Because I do not use autoincrement, because I have ID's of >type DECIMAL and autoincrement works only with Datatyp INTEGER. > >It is ok that ODMG do nothing, but it is not ok that I get no >message over exception to notified me that something was wrong >with my Object. > >Can help some body? > >regards Matthias > >-----Original Message----- >From: Will Jaynes [mailto:[EMAIL PROTECTED] >Sent: Donnerstag, 20. Marz 2003 13:11 >To: OJB Users List >Subject: Re: What happens when an insert with ODMG fails? > > >Matthias, > >If an object has an ID that is set (not null or zero) then ODMG >considers it to be an existing, persisted object that is >already in the >database. So locking it for write will result in an update, not an >insert. In general, you shouldn't be setting the id. If you want an >existing object then retrieve it with a query. If you want to create a >new instance, then create it, set the business properties, and persist >it. ODMG will assign an id and perform an insert. > >It's useful to at least think of your objects via a business interface >that has business properties, but not any persistence related >properties >like the id and a timestamp. In this thinking, you can't set the id. >This mindset gets you thinking more about the objects and less >about the >database. > >Regards, Will > >[EMAIL PROTECTED] wrote: >> Hi, >> following question about storing a new object: >> I have an Object with an attribute ID of type BigDecimal. >> I write the Object with ODMG: >> ... >> tx.lock(myObject, Transaction.WRITE); >> tx.commit(); >> if I set the ID to a valid number the every thing works fine. >> if I set the ID to a number witch still exists then no insert >> is made, but also not exception is thrown. >> Is there a way to find out if the insert was successful or not? >> regards >> Matthias Roth > > >--------------------------------------------------------------------- >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] > This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
