Could somebody help me tracing the sql statements generated by castor jdo? Do I 
have to use Log4j? If so, how do I use Log4j with castor? Or any other 
suggestions? I would like to look at trace info so that I can find out why I am 
getting the exception.

Thanks


-----Original Message-----
From: Shiva P. Kodityala [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 03, 2005 9:28 AM
To: [email protected]
Subject: RE: [castor-user] DuplicateIdentityException


Looked at that mapping.xml. 

I tried with this.

<mapping>                                                                       
  <key-generator name="SEQUENCE" >                                              
 
    <param name="sequence" value="REAL_SEQUENCE_IN_ORACLEDB"/>                  
              
  </key-generator>                                                              
                                                                                
                                                                                
                                                                                
<class name="ClassName" identity="IDN" key-generator="SEQUENCE" >
        <map-to table="REAL_TABLE_IN_ORACLEDB"/>
                ---
                ---
</class>                                                                        
       
</mapping>

Tried to add trigger and returning param(s) also under key-generator.

I am getting PrimaryKey violation error... 

Caused by: org.exolab.castor.jdo.PersistenceException: ORA-00001: unique constra
int (PrimaryKey_Constraint) violated

        at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:709)
        at org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:916)
        at org.exolab.castor.persist.LockEngine.create(LockEngine.java:489)
        at org.exolab.castor.persist.TransactionContext.create(TransactionContex
t.java:907)

        at org.exolab.castor.jdo.engine.DatabaseImpl.create(DatabaseImpl.java:37
4)
        at com.scif.app.policon.msg.TempPolicyConMessage.store(TempPolicyConMess
age.java:229)

Does it mean that key-generator starts IDN value from 1 or something like this? 

Thanks


-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 03, 2005 12:14 AM
To: [email protected]
Subject: AW: [castor-user] DuplicateIdentityException


Shiva,

as far as I can tell, this should be fine. Maybe somebody else with a more 
solid Oracle background can reconfirm this. In addition, you could have a look 
at the mapping file in src/tests/jdo, as it holds a couple of key generator 
definitions as needed by the CTF test suite.

Werner 

-----Ursprüngliche Nachricht-----
Von: Shiva P. Kodityala [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 02. August 2005 19:15
An: [email protected]
Betreff: RE: [castor-user] DuplicateIdentityException


Thanks for that link. I am using Oracle db. It looks like IDENTITY  is not for 
Oracle. I guess I should be using Sequence.



Real Name of sequence in Oracle datbase is 'idnseq'.

Does my mapping file look like this?

<mapping ...>

  <key-generator name="SEQUENCE" alias="ALIASSEQ">
    <param name="sequence" value="idnseq"/>
  </key-generator>

  <class name="ClassName" identity="IDN" key-generator="ALIASSEQ" >   
        <field name="IDN" type="integer" >         
          <sql name="IDN" type="integer"/>   
        </field>                                   
        ---
        ---
        --
  </class>
</mapping>

Thanks




-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 02, 2005 9:07 AM
To: [email protected]
Subject: AW: [castor-user] DuplicateIdentityException


Shiva,

For such situations , please use the IDENTITY key-generator as explaind at 

http://castor.codehaus.org/key-generator.html

Thanks
Werner



-----Ursprüngliche Nachricht-----
Von: Shiva P. Kodityala [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 02. August 2005 17:57
An: [email protected]
Betreff: RE: [castor-user] DuplicateIdentityException


>From the Castor documentation, this Exception must not be thrown. 

In my mapping.xml:

<class name="ClassName" identity="IDN" key-generator="MAX" >     

The value of column IDN is, in fact, is autogenerated. That means, if I put the 
row through sqlplus client, in my insert statement, I do not need to have any 
column 'IDN'. In that case, what should be key-generator? Do I have to have 
this key-generator at all?

Thanks




-----Original Message-----
From: Shiva P. Kodityala [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 29, 2005 11:36 AM
To: [email protected]
Subject: [castor-user] DuplicateIdentityException


I am getting this exception once in a while. If I understand it correctly, it 
is possible in the application I am working in.

Two processes process the (different) xml data and put to table simultaneously. 
Table has primary key which is auto generated (so, not taken from xml). Does 
DuplicateIdentityException mean that inserts are happening simultaneously and 
getting the same autogenearted primary key (happening before another's commit)? 

Fortunately, the application tries (certain number of times) again to insert 
the same xml, in case of failure, and the insert succeeds. I don't know if it 
is a good way. Pls advise.

Thanks

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------


-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to