@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 column CNTNR_SHPMNT_NUM
to be both a value and a PK.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.