openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: NPE on ManyToOne while using insertable = false, updatable = false
Date Wed, 02 Jan 2008 21:11:58 GMT

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.


Mime
View raw message