• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem persisting id field with an autoincrement field

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! I'm trying the CRUD functionality with netbeans 5.5. Thing used to be ok until I tried creating an identity columnn in SQLSever 2005. It says...



Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Cannot insert explicit value for identity column in table 'user_types' when IDENTITY_INSERT is set to OFF.Error Code: 544 Call:INSERT INTO user_types (user_type_id, description) VALUES (?, ?) bind => [null, Administrator] Query:InsertObjectQuery(com.worldpartner.wpinventory.UserTypes[userTypeId=null])
Exception Description: No transaction is currently active


It seems like SQLServer doesn't like taking the input NULL or anything in the autoincrement column. But ofcourse my userType bean would always persist that id field. What could be wrong? Thanks!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you map that id? There are probably many different generation types that Toplink defines, and maybe you aren't using the correct one.

like in Hibernate there is "native", "auto-increment" and "identity"

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic