You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Kanwar Manish <ka...@gmail.com> on 2012/06/08 14:22:03 UTC
NullPointerException - org.apache.cayenne.CayenneDataObject.setReverseRelationship
Three Classes : CreationLog, UserGroup, LogicalFolder.
Both UserGroup and LogicalFolder would have the same CreationLog details.
Error is at the last line of code below.
1. None of the Objects are Transient here.
2. Or the issue is that the same object can't be used here - Relation is
one-one with both UserGroup and LogicalFolder.
------CODE STARTS-----
CreationLog cl = dc.newObject(CreationLog.class);
cl.setCLUserMaster(um);
LogicalFolder lf = dc.newObject(LogicalFolder.class);
lf.setLFCreationLog(cl);
UserGroup ug = dc.newObject(UserGroup.class);
ug.setUGCreationLog(cl);
------CODE ENDS-------
Thanks
KM
Re: NullPointerException - org.apache.cayenne.CayenneDataObject.setReverseRelationship
Posted by Michael Gentry <mg...@masslight.net>.
Hi Kanwar,
The issue is probably your #2, but without seeing the mapping/etc,
hard to be sure. You generally can't map one-to-ones that way (two
different tables with a one-to-one with a different record in another
table).
mrg
On Fri, Jun 8, 2012 at 8:22 AM, Kanwar Manish <ka...@gmail.com> wrote:
> Three Classes : CreationLog, UserGroup, LogicalFolder.
>
> Both UserGroup and LogicalFolder would have the same CreationLog details.
> Error is at the last line of code below.
>
> 1. None of the Objects are Transient here.
> 2. Or the issue is that the same object can't be used here - Relation is
> one-one with both UserGroup and LogicalFolder.
>
> ------CODE STARTS-----
> CreationLog cl = dc.newObject(CreationLog.class);
> cl.setCLUserMaster(um);
>
> LogicalFolder lf = dc.newObject(LogicalFolder.class);
> lf.setLFCreationLog(cl);
>
> UserGroup ug = dc.newObject(UserGroup.class);
> ug.setUGCreationLog(cl);
> ------CODE ENDS-------
>
> Thanks
> KM