Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create an entity bean when the primary key has been already set

Status
Not open for further replies.

thelordoftherings

Programmer
May 16, 2004
616
IL
Hello,

Lets say I have an SQL server and I would like to create an entity bean which is connected to one of the tables.
The problem is that when a row is created at this table the primary key is a serial number which the SQL server creates automaticlly. How do I use an entity bean to create new row at this table in this case? The problem is that the create should return a primary key but this key cannot be created by the bean itself...
 
Generally speaking, you can set the id to whatever you want and it will override the generated one.
 
Thanx, but it is not true, I've tried it already and I receive an Exception. It cannot override a field which is configured as "Identity" at the SQL server... Any more ideas anyone?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top