0
@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

Column(name = "CNTNR_SHPMNT_NUM")

@XmlAttribute(name = "cntnrShpmntNum")

private Long cntnrShpmntNum;

I have a Table with name CNTNR and I made its primary key as generated with identity but its not working for me in JPA.Giving sql error-503 which says trying to insert a auto generated column.and when I tried with Column(name = "CNTNR_SHPMNT_NUM",insertable=false) its working for me but its not passing the generated value Back.The entity object giving me null as returned even the row inserted in table.

1
  • Which database? What's the meaning of the error code -503? Dec 1, 2011 at 13:47

1 Answer 1

0

Add private long id; between @GeneratedValue(...) and @Column(...) since you probably don't want the column CNTNR_SHPMNT_NUM to be both a value and a PK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.