OpenJPA (or for that matter anyone other than the designer) has no way to
know that  
private Integer cdProduto;
refers to the primary key of the field
private Produto produto;//read only

You have tell that to OpenJPA.

So what you can do (if the design insist on a arguably erroneous domain
model for all the wrong reasons) to maintain referential integrity is:

public Item(....,Produto p) {
  this.cdProduto = p.getCdProduto();
  this.produto = p;
}

-- 
View this message in context: 
http://www.nabble.com/NPE-on-ManyToOne-while-using-insertable-%3D-false%2C-updatable-%3D-false-tp14582403p14586279.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to