With Sculptor 1.0 you have to implement the logic for these kind of queries
either in the RepositoryImpl or in the AccessImpl. 

The example findMediaByCharacter is rather complicated and I don't think it
will be feasible to generate it. I implemented it like this:
<code>
    public List<Media> findMediaByCharacter(Long libraryId, String
characterName) {
        // Retrieve the MediaCharacter objects via another Repository
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("characterName", characterName);
        List<MediaCharacter> foundCharacters = 
           
getMediaCharacterRepository().findByQuery("MediaCharacter.findByCharacterName", 
                parameters);
        
        // filter matching Media for the found characters and the specified
library
        List<Media> matchingMedia = new ArrayList<Media>();
        for (MediaCharacter c : foundCharacters) {
            for (Media m : c.getExistsInMedia()) {
                if (m.existsInLibrary(libraryId)) {
                    matchingMedia.add(m);
                }
            }
        }
        
        return matchingMedia;
    }
</code>


However, there might be more simple scenarios for which it might be possible
to have better support for generated queries. Do you have any idea?



-- 
View this message in context: 
http://www.nabble.com/General-question---querying-entities-by-values-of-related-domain-objects-tf4223122s17564.html#a12060961
Sent from the Fornax-Platform mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to