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?
Andrus
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 {
> ...
> }
This archive was generated by hypermail 2.0.0 : Thu Jun 22 2006 - 11:59:58 EDT