enumeration member variable is changing columndefinition
--------------------------------------------------------

         Key: EJB-108
         URL: http://jira.andromda.org/browse/EJB-108
     Project: EJB Cartridge
        Type: Bug

    Reporter: Luca Dall'Olio
 Assigned to: Vance Karimi 


I just noticed that, when specifing an integer member variable (by using the 
@andromda.persistence.enumeration.member.variable tagged value) for an 
enumeration, the VARCHAR columndefinition is never created in the generated 
entity bean declaring the enumeration as an attribute.

By looking at the ejb cartridge source code (handleGetColumnDefinition() in 
EJB3EntityAttributeFacadeLogicImpl) it seems like integer member variables are 
not taken into account:

            for (final Iterator iter = 
this.getType().getAttributes().iterator(); iter.hasNext(); )
            {
                AttributeFacade attribute = (AttributeFacade)iter.next();
                if (!attribute.getType().isStringType())
                {
                    isOrdinal = true;
                    break;
                }
                if (attribute.getName().length() > length)
                {
                    length = attribute.getName().length();
                }
            }
            if (!isOrdinal)
            {
                definition = "VARCHAR(" + length + ")";
            }
        }

I think that member variables *are* having effect (while they shouldn't) over 
the column definition because of the code above: i noticed that when I have an 
enumeration with only say 3 string literal parameters the column is (correctly) 
defined as VARCHAR(20), whereas if I add an integer member variable the column 
definition disappears, so I think that the code above should contain something 
(considering also EJB-104) like this

                AttributeFacade attribute = (AttributeFacade)iter.next();
                if (attribute.isMemberVariable() && !attribute.isIdentifier())
                {
                    continue;
                } 

because normal member variables should not interfere when andromda is trying to 
understand the type of an enumeration values... or, better, andromda should 
simply take into account my declared annotation 
(@andromda.persistence.enumeration.type) ? 

-- 
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


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Reply via email to