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.

vishnu
  • 3,985
  • 4
  • 19
  • 6

1 Answers1

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.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820