[ http://jira.andromda.org/browse/HIB-159?page=comments#action_12486 ]
     
Tomasz Bech commented on HIB-159:
---------------------------------

I propose to leave the function isRequired not overidden in 
HibernateEntityAttributeLogicImpl and do extra isRequiredInheritance for usage 
in hibernate template (so in any other template real isRequired is still 
accessible).

> not-null for 'class' inheritance set to false wrongly
> -----------------------------------------------------
>
>          Key: HIB-159
>          URL: http://jira.andromda.org/browse/HIB-159
>      Project: Hibernate Cartridge
>         Type: Bug
>     Reporter: Tomasz Bech
>     Assignee: Carlos Cuenca
>      Fix For: 3.2-RC1

>
> 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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

Reply via email to