sophie fischer wrote:
> 
> Hi Jonas support team,
> 
> I upgraded my Jonas version 2.2.6 to 2.3. All was very easy (thanks!),
> except for a
> duplicate key exception I am encountering now.
> 
> Situation is as follows. If an entry of table is updated the entry is
> first deleted
> and then inserted. This is necessary, as sometimes the key of the entry
> is changed.
> If the key is changed, the delete and insert operation run fine. But if
> the key
> is not changed, a DuplicateKeyException is raised. While the entry is
> not anymore
> available in the database. In release 2.2.6 the DuplicateKeyException
> was not raised.
> I did some tests to check this.
> 
> How can I solve this problem? I tried to set the transaction attribute
> to 'RequiresNew',
> but that did not solve the problem. And why does it occur in version 2.3
> and not
> in version 2.2.6? I checked the mailing list, but did not see this
> problem mentioned.
> I would appreciate your opinion on this matter.
> 
> Sophie
> 

Hi Sophie,
I think it is a bug in JOnAS
I have reproduced your pb with your example
and even in simpler test:
This simple test raises DuplicateKeyException:
            utx.begin();
            p0 = ehome.create(man0, "999");
            utx.commit();  
            utx.begin();
            ehome.remove(man0);
            p0 = ehome.create(man0, "1000");
            utx.commit(); 

The reason is that in the previous versions of JOnAS the DuplicateKey
was not catchable from an entity CMP. Why? because the exception
raised by JDBC drivers in the case of DuplicateKey in not always
the same SQLException, the exception raised depends of the JDBC Driver.
So we are not able to generate generic code
so in case of problem in the sql statement in a creation we throw
always a CreateException.
We have added some code before calling the creation sql statement
in order to test if the corresponding entity bean is present in the
cache
and if it is the case throw the duplicate key exception.
It was the only case where we can throw the DuplicateKey exception!
Unfortunately there are cases as yours where the entity bean is remove
but is still in the cache.

I think we  have to suppress the test we have added, the cost to pay
is that we will not be able to catch DuplicateKeyException but only
CreateException.


Regards,
-- 
        Philippe

Philippe Coq  Evidian   Phone: (33) 04 76 29 78 49
Bull S.A  - 1 rue de Provence - 38432 Echirolles Cedex France
Download our EJBServer at http://www.objectweb.org
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to