cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan <>
Subject Re: ClassCastException ...ToManyList cannot be cast to ...Persistent
Date Tue, 17 Mar 2009 17:52:55 GMT
Andrey Razumovsky <razumovsky.andrey <at>> writes:

> Hi Dan!
> It seems quite strange to me that relationship from PARTY_CASE_LINK to PARTY
> is called "parties". So seems it's to-many. But PARTY_CASE_LINK has
> "partyid", so no more than one PARTY can exist for PARTY_CASE_LINK.
> Also can't flattened relationships [1] be useful for you in this case?
> [1]
> Andrey


Ahh - yes - there was a flaw in the data model - the relationships to the
PARTY_CASE_LINK table should be toMany, but all of the reverse relationships
should be toOne. 

So i now have relationships that allow me to get 

List<PartyCaseLink> casesLinks = pty.getPartyCases();
for (PartyCaseLink caseLink : casesLinks)
     CourtCase cases = caseLink.getCase();
     ... do stuff

That is now resolved, and I can get "half" way to the objects that I want
without additional DB queries using:


BUT -- i see that cayenne is not allowing me to addPrefetch all the way to the
"case" -- e.g. i want to:


to avoid going back to the database N times (1 per row). 


Also - flattened relationships look interesting, but since I have a "real"
relationship in the database there already, shouldn't i be able to use that?

Thanks again in advance. 


View raw message