Dao create operation returns incorrect class when polymorphic
-------------------------------------------------------------

         Key: SPRING-142
         URL: http://jira.andromda.org/browse/SPRING-142
     Project: Spring Cartridge
        Type: Bug
    Reporter: Ryan Marsh
 Assigned to: Chad Brandon 


Problem exists in following templtes 
cartridges/andromda-spring/src/templates/spring/SpringDao.vsl
cartridges/andromda-spring/src/templates/spring/hibernate/SpringHibernateDaoBase.vsl

The Dao create operations for single entities (any of the create operations 
unrelated to creating collections). Return 
$entity.root.fullyQualifiedEntityName not $entity.fullyQualifiedEntityName. 
When $entity.fullyQualifiedEntityName is a specialization of another class. 

For instance this means that a create operation for an <<Entity>> Person  will 
rather return the most general class (shy of Object) in the inheritance tree. 
The create operations in the DaoBase actually must cast the resulting object 
from create(transform, entity) so that it matches the return type. Why not have 
it cast to $entity.fullyQualifiedEntityName??? If I want to create and use a 
superclass then I will do that explicitly. Otherwise I am forced to cast every 
single create operation I perform.

Here's the simple of it. PersonDao.create() should return Person, 
CarDao.create() should return Car, not a generalization high up in the 
inheritance tree.




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

Reply via email to