openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashish paliwal <ashishpaliwal....@gmail.com>
Subject Re: [NEWBIE] OpenJPA Cannot get id field returned
Date Wed, 09 Sep 2009 08:30:03 GMT
If the .java definition is long id then mysql definition should be bigint
id.
But the best solution is to create the java file and let the openjpa create
the table on its own. This will happen automatically when the first insert
statement is called and openjpa finds that there is no such entity
registered by this name.
If it is possible then create the table and do insertion from openjpa
itself.

regards

On Wed, Sep 9, 2009 at 1:52 PM, B.L. Zeebub <roger.varley@googlemail.com>wrote:

>
>
>
> ashishpaliwal wrote:
> >
> > My guess.
> > Since you are creating table and inserting outside of openjpa there might
> > be
> > a data type mismatch between the two id's definition in .java file and in
> > database. For ex, in java file taking long as data type of id means
> bigint
> > in mysql. So, I am "guessing" that there is difference of data types
> > between
> > the two definitions.
> >
>
> The DDL that created the table is below and the entity definitions were
> created using the 'Create Enties from Table' tool in Eclipse. Any
> suggestions as to what the .java definition for the id field should be?
>
> CREATE TABLE ids2.Platform (
>       id INT NOT NULL AUTO_INCREMENT
>     , PlatformName VARCHAR(32)
>     , PRIMARY KEY (id)
>  ) ENGINE = InnoDB;
>  ALTER TABLE ids2.Platform MODIFY COLUMN PlatformName VARCHAR(32)
>      COMMENT 'Platform Description';
>
> Regards
> --
> View this message in context:
> http://n2.nabble.com/NEWBIE-OpenJPA-Cannot-get-id-field-returned-tp3601995p3609198.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
Ashish Paliwal
Mobile : 9305128367
IIT Kanpur
India

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message