Object[] not being carried over to generics in DAO operation
------------------------------------------------------------
Key: UMLMETA-108
URL: http://jira.andromda.org/browse/UMLMETA-108
Project: UML Metafacades
Issue Type: Bug
Affects Versions: 3.4
Environment: java 1.6, maven 2.2, magicdraw 16.8, emf2.2 model
Reporter: Mike Dikan
Assignee: Bob Fields
Attachments: mda-testing2.tar.gz
Taken from: http://forum.andromda.org/viewtopic.php?f=9&t=6850
I have an Entity with a legacy operation that is designed to return a
List<Object[]>. Changing the expected return type is an option but a difficult
one. I have tried the following approaches to set the type ( in MD 16.8 ):
Setting type to 'Object' with the type modifier of '[]'
Setting type to 'Object[]' with no type modifier
Setting type to 'Object[]' with type modifier of '[]'
In every case, my Daos (interface and base) will generate a method with return
type of List<Object>. I have also tested having List<Object[]> as a operation
parameter and I see the same result (List<Object>). I have no problem with
Object[] with no multiplicity (not a generic in a List).
(continued)
I have enableTemplating on, and I use multiplicity for the List. But the
Object[] inside the list from the model is resulting in a List<Object> instead
of a List<Object[]> being generated in the code. As mentioned above I used all
the intuitive datatype settings that I could think of. This is a common
occurence for me becuase when using hibernate's Query and SqlQuery classes,
List<Object[]> is a very common return from the Query.list() method. I can
avoid all this by doing unchecked casting later down in my implementation code,
but the Object[] just seems more appropriate.
(continued)
I tried what another poster suggested in a semi-related forum post: to create a
phantom datatype to trick andromda into generating the right Type, but it did
not work. I created a datatype in MD called 'Object[]' and assigned that to my
return parameter's 'type'. I then changed multiplicity to '0..*' and tried
regenerating, but instead of seeing a List<Object[]>, I again saw a
List<Object>. It seems that andromda is actively stripping out the array type
modifier when there is a multiplicity involved in a Type definition.
(continued)
Related to metafacades under
AssociationEndFacadeLogicImpl.handleGetGetterSetterTypeName and
ModelElementFacadeLogicImpl.handleGetFullyQualifiedName.
--
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
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d