Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Modulated PK column creating problem in CREATE

Just remove @GeneratedValue(strategy = GenerationType.IDENTITY)

On 8/16/2010 11:44 AM, Tanujit Chowdhury wrote:
Hi,
Thanks for the prompt answer. As I have explained that there is no PK in that table but as I must have to declare one Column as an @ID to get it deployed.
But now the problem is the PK is not getting inserted.

Any help on this is appreciated.

Thanks,
Tanujit

On Mon, Aug 16, 2010 at 5:40 PM, Andrei Ilitchev <andrei.ilitchev@xxxxxxxxxx> wrote:
PK value assigned to the object is ignored if  @GeneratedValue(strategy = GenerationType.IDENTITY) is specified.


On 8/16/2010 11:32 AM, Tanujit Chowdhury wrote:
Hi,
I have a table which does not have PrimaryKey. But I have to declare a column as PK by this annotations:
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "UserKeyfield")

When I am performing an INSERT in this table using JPQL I am getting exception as null value can not be inserted into database for the column "UserKeyfield". I have checked that my Java object representing that table is having that PK value but while inserting it is just not getting inserted. May be because it is defined as "@GeneratedValue(strategy = GenerationType.IDENTITY)".

Is there any workaround to explicitely add the PK value while inserting the object into database?

--
Tanujit Chowdhury

_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--
Tanujit Chowdhury

_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top