You should always create a context and then create objects within that context 
using the methods Cayenne gives you. This is different to the undecorated POJO 
that Hibernate allows you to create.

Ari

On 7/11/12 3:39pm, Aleksey V. Katorgin wrote:
Hi! I've manually created two transient DataObjects (Group and GroupItem
for example) and now I want to set relationship between its.

     groupItem.setGroup(group);


But it throws NPE:

java.lang.NullPointerException
at
org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:278)

Because of trying to raise property:
      getObjectContext().propertyChanged(this, relationshipName, oldTarget,
value);

with null objectContext.


Is it feature  what I can't set relationship for transient objects or bug?




Thanks.


--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Reply via email to