I updated to OpenJPA 1.1.0, and I'm not getting the above exception anymore, but its still not working 100%.
Updated example code: em.getTransaction().begin(); TblScmpdt tblScmpdt = new TblScmpdt(); tblScmpdt.setAdmsysCde("EBSTA"); tblScmpdt.setFndCde("0001526"); tblScmpdt.setGccCde("A1526"); tblScmpdt.setPflcmnDte(new Date()); TblPdtbnfcde tblPdtbnfcde = em.getReference(TblPdtbnfcde.class, new Integer(13)); tblScmpdt.setPdtcdeId(tblPdtbnfcde.getTblPdtcde().getPdtcdeId()); tblScmpdt.setTblPdtcde(tblPdtbnfcde.getTblPdtcde()); //First need to save parent, this wouldn't be necessary if the child didn't have a composite key tblScmpdt = em.merge(tblScmpdt); em.flush(); //Have to flush otherwise JPA tries to persist child before parent TblPdtbnf tblPdtbnf = new TblPdtbnf(); tblPdtbnf.setCmnDte(new Date()); tblPdtbnf.setTblPdtbnfcde(tblPdtbnfcde); tblPdtbnf.setPdtbnfId(tblPdtbnfcde.getPdtbnfId()); tblPdtbnf.setTblScmpdt(tblScmpdt); tblPdtbnf.setScmpdtId(tblScmpdt.getScmpdtId()); //this should get done automatically by JPA tblScmpdt.getTblPdtbnfs().add(tblPdtbnf); //merge again to save child(ren) tblScmpdt = em.merge(tblScmpdt); em.getTransaction().commit(); -- View this message in context: http://www.nabble.com/%40OneToMany-%40ManyToOne%2C-Bidirectional%2C-Composite-Key-BUG-tp17801245p17820704.html Sent from the OpenJPA Users mailing list archive at Nabble.com.