@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.
Add
private long id;
between@GeneratedValue(...)
and@Column(...)
since you probably don't want the columnCNTNR_SHPMNT_NUM
to be both a value and a PK.