cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lothar Krenzien <lkrenz...@web.de>
Subject Re: FaultFailureException
Date Thu, 22 Jun 2006 18:54:30 GMT
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


Mime
View raw message