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

Hi,
I am using MS SQL db, details are below:

Microsoft SQL Server  Version: Microsoft SQL Server Yukon - 9.00.3077
Driver: SQLServer  Version: 3.70.27 (029619.012905.017415)

This is an existing database and I do not know how to check "have you set up the Identity in the database" ?

Can you help?

Thanks,
Tanujit

On Mon, Aug 16, 2010 at 5:37 PM, Christopher Delahunt <christopher.delahunt@xxxxxxxxxx> wrote:
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

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




--
Tanujit Chowdhury

Back to the top