Hi Andrus,
thanks a lot for your answer ! I think it's clear now.
Maybe it's easier to create a dummy partner so that the relationship is not null.
Lothar
> I think I might know the cause.
>
> tblPerson -> tblPartner relationship is a one-to-one where one side
> is not a PK (tblPartner.personId). IIRC we had unresolved Jira issue
> (s) related to nullable unique to-one FK ("unique" implies that the
> relationship that looks like one-to-many is in fact one-to-one; while
> "nullable" part is what causes the problem with faults and other
> things).
>
> One suggested workaround is to map the relationship as many-to-one
> and create cover methods if you want to treat it as one-to-one. This
> should work smoothly.
>
> Wonder if this is related to the earlier exceptions as well?
>
>
>
> On Jun 22, 2006, at 7:12 PM, Andrus Adamchik wrote:
>
> > The error happens mostly when cayenne tries to resolve the relation
> > tblPerson -> tblPartner. It's an 1:1 relation but the relation can
> > be null.
>
>
> > DataContext context = getDaoContext(ctx);
> > TblAccount account;
> > Expression expr = ExpressionFactory.matchExp("loginName", loginname);
> > List<TblAccount> accountList = context.performQuery(new SelectQuery
> > (TblAccount.class, expr));
> > return accountList (0);
> >
> >
> > and then :
> >
> > if (account.getTblPerson().getTblPartner() != null) {
> > TblPartner partner = account.getTblPerson().getTblPartner();
> > partner.getName() ; <----- here the exception happens
> > }
> > else {
> > ...
> > }
>
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000071
This archive was generated by hypermail 2.0.0 : Thu Jun 22 2006 - 14:54:56 EDT