openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicolas13 <nico...@dmailer.com>
Subject Re: Cannot get primary key value (mysql)
Date Thu, 12 Aug 2010 14:42:14 GMT

>I'm going to ask the obvious.... 
as you guessed, i'm a newbe... your question is legitimate :-)

>but is the id column in your db named idMigration?
Yep.


The strange thing (to me, i guess there must be a obvious reason i'm failing
to understand) is that if i put the @Id annotation on another field of my
entity, specifying the column like that:
-------------------------------
@Id
@Column(name="idMigration")
private int id;
	
private int idMigration;
------------------------------

it works as i expected: idMigration is loaded like a regular column.

Is there any reason why i my primary key is not loaded like the other
fields?

thanks for you help.

>Another thing, I see you are using @GeneratedValue(strategy=
>GenerationType.AUTO) for your id... but I assume you want to use the MySQL
>AUTO_INCREMENT function? If so, change GenerationType.AUTO to
>GenerationType.IDENTITY.
Ok, thanks for the advice.


-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Cannot-get-primary-key-value-mysql-tp5412600p5416352.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message