EmbeddedId « Key « JPA Q&A





1. JPA Auto Incrementing EmbeddedId (Composit primary key values).    coderanch.com

Hi All, I have a problem with JPA composit primary key. when I am inserting values into Postgresql I am getting below exception Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60-fcs (11/17/2008))): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: null value in column "id_corporative_event" violates not-null constraint Error Code: 0 Call: INSERT INTO ...

2. JPA Auto Incrementing EmbeddedId (Composit primary key values)    forums.oracle.com

@Entity @Table(name = "tb_corporate_event", schema = "public") public class TbCorporateEvent implements java.io.Serializable { // Fields private TbCorporateEventId id; .................... .................... @EmbeddedId @AttributeOverrides( { @AttributeOverride(name = "idStock", column = @Column(name = "id_stock", nullable = false)), @AttributeOverride(name = "idCorporativeEvent", column = @Column(name = "id_corporative_event", nullable = false))}) public TbCorporateEventId getId() { return this.id; } public void setId(TbCorporateEventId id) { this.id = id; } ...