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

Hello,

I believe Andrei responded to your last email "How to generate the PK?" that seems to be related:
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05115.html

If it didn't help, what database are you using and how have you set up the Identity in the database?

Best Regards,
Chris

On 16/08/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

Back to the top