3 Replies Latest reply on Jun 17, 2007 8:12 AM by ruchi123456

    Getting Exception - Cannot insert explicit value for identit

    ruchi123456

      Good Morning,

      I am trying to use EJB 3 with jboss4.0.5. Ran into a (simple I hope problem). Defined a very simple class that displays a few rows from the database. I am using SQL 2000 and my Primary Key is an Identity column. When I try to add a row it attempts to insert a value into the key column as well which of course does not work:

      com.inet.tds.SQLException: [DB3]Cannot insert explicit value for identitycolumn in table 'Address' when IDENTITY_INSERT is set to OFF.

      I tried annotating the column both as: @Id and also as:
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      but got the same error.

      I am using jboss4.0.5 by the way.

      Can someone direct me in the right direction please?
      Regards,
      Ruchika