Kanwar Manish | 8 Jun 2012 14:22
Picon

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
Michael Gentry | 9 Jun 2012 14:55
Favicon

Re: NullPointerException - org.apache.cayenne.CayenneDataObject.setReverseRelationship

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 <kanwarmanish <at> 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-------
>
(Continue reading)


Gmane