You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by do...@xsinet.co.za on 2013/10/02 16:50:47 UTC
RelationshipQuery
Hi
1. I have an ObjEntity with a relationship that returns a Map, which I
need to refetch.
public Map<String, ActivityResult> getResults() {
return (Map<String, ActivityResult>)readProperty(RESULTS_PROPERTY);
}
How do I go about it ?
2. With a regular relationship that returns a list I used
RelationshipQuery like so:
public List<PatientAllergy> getAllergies()
{
RelationshipQuery refreshAlrgy = new RelationshipQuery
(
getObjectId(), ALLERGIES_PROPERTY
);
return getObjectContext().performQuery( refreshAlrgy );
}
I didn't want any caching on this relationship, hence the above. Not sure
if its the right way of doing this though.
Anyway with reference to question 1. performQuery returns a list, but I
need the Map ?
Thanks.
Re: RelationshipQuery
Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 3/10/13 12:50am, dollj@xsinet.co.za wrote:
> Anyway with reference to question 1. performQuery returns a list, but I
> need the Map ?
1. Open cayenne modeler
2. Choose the Java entity you want
3. Go to "relationships" and click on the relationship you want to model
4. Click the little "I" in the toolbar at the top
5. In the ObjRelationship inspector now open, change the collection type to List, Collection, Map, or Set.
Ari
--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A