Werner,

I'm afraid this problem is not fixed completely since the version I'm using is 
built from CVS. Would you please have a try?

Thanks,
Sean

----- Original Message ----- 
Sent: Thursday, December 02, 2004 5:27 PM
Subject: Re: [castor-user] [JDO] Key Generator Failure. Duplicated Identity is 
generated!


> 
> Sean,
> 
> are you still using Castor 0.9.5.3 ? Afair, this problem has been fixed in
> CVS, and will be part of the upcoming 0.9.6 release.
> 
> Thanks
> Werner
> 
> PS The problem fixed is that as a result of an ObjectNotFoundException,
> sometimes a lock has not been released.
> 
>> This might be a bug of castor, please try on your project to see if it
>> would happen.
>> 
>> I'm using mysql and my mapping file contains something like this:
>> -------------------------------------
>>  <key-generator name="HIGH-LOW">
>>   <param name="table" value="sequence"/>
>>   <param name="key-column" value="tablename"/>
>>   <param name="value-column" value="currentid"/>
>>   <param name="same-connection" value="true"/>
>>   <param name="grab-size" value="1"/>
>>  </key-generator>
>> 
>>  <class identity="id" key-generator="HIGH-LOW" name="model.User">
>>   <map-to xml="user" table="user" />
>>   <field name="id" type="integer">
>>    <sql name="id" type="integer" />
>>   </field>
>>   <field name="name" type="string">
>>    <sql name="name" type="varchar" />
>>   </field>
>>  </class>
>> 
>> Suppose that current MAX id of user table is 1000, and the following
>> statments:
>> -------------------------------------
>> Integer id = new Integer(1001);
>> User user = database.load(User.class, id);
>> 
>> will throw an exception:
>> -------------------------------------
>> org.exolab.castor.jdo.ObjectNotFoundException: The object of type
>> model.User with identity 1,001 was not found in persistent storage
>> 
>> After this, new user object could never be created:
>> -------------------------------------
>> User user = new User();
>> user.setName("Sean");
>> database.create(user);
>> 
>> throws an exception:
>> -------------------------------------
>> org.exolab.castor.jdo.LockNotGrantedException: Lock is already existed for
>> the new oid.
>>  at
>> org.exolab.castor.persist.LockEngine$TypeInfo.rename(LockEngine.java:1357)
>>  at
>>
> org.exolab.castor.persist.LockEngine$TypeInfo.access$400(LockEngine.java:1038)
>>  at org.exolab.castor.persist.LockEngine.create(LockEngine.java:496)
>>  at
>>
> org.exolab.castor.persist.TransactionContext.create(TransactionContext.java:907)
>>  at
>> org.exolab.castor.jdo.engine.DatabaseImpl.create(DatabaseImpl.java:374)
>>  ...
>> org.exolab.castor.jdo.PersistenceException: Nested error: Key Generator
>> Failure. Duplicated Identity is generated!
>> 
>> 
>> I searched the Internet and can't find any solution to the exception. Do
>> you have any suggestion?
>> http://hypermail.linklord.com/castor-dev/2004/Apr/4119.html
>> 
>> Thanks,
>> Sean
> 
> -- 
> NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
> GMX DSL-Netzanschluss + Tarif zum superg�nstigen Komplett-Preis!
> 
> 
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-user
>
----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to