[ http://jira.andromda.org/browse/SPRING-154?page=comments#action_12607 ]
Jens Vagts commented on SPRING-154: ----------------------------------- You can always create your own DAO methods: you only have to make them "static"! These methods can have parameters and return types what ever you want! (as described at http://team.andromda.org/docs/andromda-spring-cartridge/howto1.html) Another solution is to define a hibernate formula attribute directly for your entity with @andromda.hibernate.formula. > DAO methods that don't return Entities of the DAO > ------------------------------------------------- > > Key: SPRING-154 > URL: http://jira.andromda.org/browse/SPRING-154 > Project: Spring Cartridge > Type: Improvement > Versions: 3.2-RC1 > Reporter: Paul Pavlidis > Assignee: Chad Brandon > Attachments: patch.txt > > Use case; we want a method to return the size an associated collection > without fetching the (large) collection. This is easily implemented in HQL > for example (select count(...)) but AndroMDA doesn't seem to support adding > methods to DAOs except for FinderMethods: they have to either return an > Entity or a Collection of Entities. In this case the return type is an > Integer but other appliations come to mind. > The workaround is to > 1) Set up the method as desired > 2) Change the SpringHibernateDaoBase.vsl template to make the generated > method compatible with the altered return type. > A patch follows (which also fixes what is in my view a lurking bug: the cast > should be to the return type of the finder, not to the entity type, to be > more consistent) > However, this abuses the <<FinderMethod>> stereotype and will probably break > if the method returns a Collection that is then run through a transform > callback (never tried this). If there's a better way.... -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
