cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias SCHOESSLER <Tobias.Schoess...@unvienna.org>
Subject Re: Problems with MySql id type with AUTO_INCREMENT
Date Tue, 29 Aug 2006 11:15:50 GMT
it was mapped as

<db-attribute ... type="INTEGER" length="10"/>

I changed the type to BIGINT and now the PK is always a Long. Great,
thanks. This was hard to guess.

Is the jdbc type mapping messed up for the MySQL Adapter?

When I reverse engineer the db from scratch

INT UNSIGNED is mapped as <db-attribute ... type="INTEGER" length="10"/>

INT is mapped as <db-attribute ... type="INTEGER" length="11"/>

Could you give me a hint where to change this mapping so I do not have to
set it to BIGINT manually?

thank you

Tobias




                                                                           
             Andrus Adamchik                                               
             <andrus@objectsty                                             
             le.org>                                                    To 
                                       cayenne-user@incubator.apache.org   
             Tuesday, 29                                                cc 
             August 2006 11:00                                             
                                                                   Subject 
                                       Re: Problems with MySql id type     
             Please respond to         with AUTO_INCREMENT                 
             cayenne-user@incu                                             
             bator.apache.org                                              
                                                                           
                                                                           
                                                                           
                                                                           




How is the column mapped in the Modeler? Have you tried mapping it as
BIGINT?

Andrus



On Aug 28, 2006, at 1:22 PM, Tobias SCHOESSLER wrote:

>
> I use cayenne 1.2, MySql. AUTO_INCREMENT ids
>
> the type of the id field in the mysql schema is set to
>
> INT NOT NULL AUTO_INCREMENT UNIQUE
>
> I create an object of this table with cayenne and commit. I see the
> row
> inserted ok. When accessing the Id of the object via
>
>       getObjectId().getIdSnapshot().get(this.FOLDER_UID_PK_COLUMN)
>
> in the same DataContext the type of the Object retruned is a Long.
> (Though
> I would have expected it to be an Integer from the MySql jdbc
> documentation)
>
> When I use a fresh DataContext and retrieve the same row the id object
> returned by
>
>       getObjectId().getIdSnapshot().get(this.FOLDER_UID_PK_COLUMN)
>
> seems to be an Integer ?
>
>
>
> I tried to set the type to
>
> INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
>
> which is supposed to be of Long type from the jdbc type
> documentation of
> MySql.
>
> to force the id object always to be a Long but cayenne still
> returns an
> Integer when reading  from the db.
>
> any ideas?
>
> thanks
>
>
>
>




Mime
View raw message