not-null for 'class' inheritance set to false wrongly
-----------------------------------------------------

         Key: CORE-103
         URL: http://jira.andromda.org/browse/CORE-103
     Project: AndroMDA Core
        Type: Bug
    Reporter: Tomasz Bech
 Assigned to: Chad Brandon 


Scenario: Entity A - inheritance type'interface', Entity B : extends A - 
inheritance type 'class'.
In B there is an attribute which is required. In generated hibernate xml file 
'not-null' is set to false (should be true). The buggy part of code:
    public boolean isRequired()
    {
        boolean required = super.isRequired();
        if (this.getOwner() instanceof HibernateEntity)
        {
            HibernateEntity entity = (HibernateEntity)this.getOwner();
            //BUG: here should be "if any of Generalization.type != 
'interface')"
            if (entity.isHibernateInheritanceClass() && 
entity.getGeneralization() != null)
            {
                required = false;
            }
        }
        return required;
    }

Additionaly, imho it is not good to handle it in java code, the better place is 
the velocity template. If the same bean is used for mapping both Hibernate and 
Struts/WEB presentation layer, the information about not-null is lost (it is 
overriden to 'false' by AndroMDA for sublcasses). So there is a need to add 
additional tagged value to mark not-null field for presentation layer - it is 
kinda awkward.





-------------------------------------------------------
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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Reply via email to