How to Insert values in to the table using EJB without inserting auto increment field in the table?

1 comment

Bala asked:

I am trying to insert the values in a table which has a field that is a auto increment and also primary key field.
I dont want to insert values in to that field.
While trying without set method for that field.
Showing error as “should insert values for primary key field”

Please help me out..

No related posts.

{ 1 comment }

Kevin

I’m not a Java developer…but in all cases you are using SQL to make inserts…..so are you not specifying each table field in order, leaving out the first auto incremented primary key?

INSERT INTO TableName (field_2, field_3, field_4)
VALUES (value_2, value_3, value_4);

I may be missing something here…?

Previous post:

Next post: