Hi !

This is my mapping :

  <class name="com.ecommerce.jdo.Photo" identity="id">
    <description>Photo</description>
    
    <cache-type type="none" />
    
    <map-to table="photo" />  
  
    <field name="id" type="integer">
      <sql name="id" type="integer" />
    </field>        
    
    <field name="title" type="string">
      <sql name="title" type="char" />
    </field>    
    
    <field name="description" type="string">
      <sql name="description" type="char"/>
    </field>    
    
    <field name="file" type="string">
      <sql name="file" type="char"/>
    </field>
    
    <field name="albumId" type="integer">
      <sql name="id_album" type="integer" />
    </field>        
    
  </class>

This is my table:

Photo
| id  int(10) unsigned  PRI auto_increment 
| title varchar(60)      
| description varchar(120)    
| file varchar(35)     
| id_album int(10) unsigned 

Should I set ID even though it's an MySQL auto_increment field ?

-----Mensagem original-----
De: Stein M. Eliassen [mailto:[EMAIL PROTECTED]
Enviada em: quarta-feira, 24 de setembro de 2003 13:59
Para: [EMAIL PROTECTED]
Assunto: Re: [castor-dev] Is it strange or not ?


Michel Bertrand wrote:
> Hi !
> 
> I'm having the famous org.exolab.castor.jdo.DuplicateIdentityException problem
> when trying to store an object. The code fragment which causes this error is:
> 

<snip/>

> The exception happens when the second part of the code is executed. I don't
> know what's happening, because I have already finished the first transaction 
> and so I would be able to start a new one, am I right ?
> 

How do you create the identity for Photo?

If you look in the database and the identity for the first item is 0 
then you must configure the database create an auto-id. You must also 
configure Castor accordingly.

Stein

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to