db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chen <alex_c...@sbcglobal.net>
Subject Re: unique constraint violation
Date Fri, 10 Mar 2006 00:38:53 GMT
Thomas,
   Thanks for the information.  I am using Torque 3.0 and the Oracle 
driver is downloaded from Oracle site, so I do not know why the message 
about transaction, either.
I did not specifically configure Torque to use ID broker.
How to configure Torque to use IdMethod 'native'?  What is the 
difference between the two?

Is there document I can browse?

Thanks for the help.

Alex


Thomas Fischer wrote:

>Alex Chen <alex_chen@sbcglobal.net> schrieb am 08.03.2006 20:24:36:
>
>  
>
>>I have seem the following exceptions in my application:
>>
>>java.sql.SQLException: ORA-00001: unique constraint
>>(DBUSER.USER_INFO_PK) violated
>>
>>It seems that the same primary key has been used again by the ID broker.
>>    
>>
>
>There have been a few messages in the past which seem to indicate that the
>idbroker's thread safety might not be water-proof, but noone has been able
>to pinpoint it yet. In normal circumstances, I'd suspect the same here, but
>with the warning you gave below, I'm not so sure.
>
>  
>
>>When we use Torque to 'save' the object, the ID broker automatically
>>allocates the primary key for that object, right?
>>    
>>
>
>Correct.
>
>  
>
>>I do not know what kind of scenario can cause the exception?
>>
>>When this happens, does ID broker try to reuse the same ID for the next
>>insertion?  If so, wouldn't that make the exception happen indefinitely?
>>    
>>
>
>If this is really a thread safety issue, there is a good chance that
>re-trying the insert would work.
>
>  
>
>>Another questions is that I also see the following warning message in my
>>log:
>>WARN  [main] IDBroker - IDBroker is being used with db 'payroll', which
>>does not support transactions. IDBroker attempts to use transactions to
>>limit the possibility of duplicate key generation.  Without
>>transactions, duplicate key generation is possible if multiple JVMs are
>>used or other means are used to write to the database.
>>    
>>
>
>That is a bit strange. The usual reason for this error is that you cannot
>access the database. But given your message above, this clearly tells one
>that you can connect. Is ist posible that you have defined more than one
>database ?
>
>  
>
>>This may be something that causes the problem.  How do I let IDBroker
>>know that my DB server support 'transaction'?
>> I am using Oracle and definitely it support transaction.
>>    
>>
>
>Torque just asks the database driver. The database driver knows whether the
>database supports transactions or not. Maybe you are using an really old
>driver ??? I am using Oracle's  9.2.0.4 driver,  and get no such messages.
>
>By the way, is there any reason you are using the IdBroker ? For "normal"
>purposes, the IdMethod "native" is the better choice in my opinion. I have
>used the IdMethod "native" for years without any problems.
>
>    Thomas
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message