[ 
http://thecla.homeftp.net:8380/jira//browse/SPRING-30?page=comments#action_10841
 ]
     
Carlos Cuenca commented on SPRING-30:
-------------------------------------

This is also happenning in the hibenate cartridge, I had made a patch using 
another parameter to determine if it is inheritance, but I guess it is much 
better to add  the method on the facade.

Patch:
#macro (renderPropertiesAndAssociations $entity $isInheritance)
#foreach ($attribute in $entity.attributes)
#if (!$attribute.identifier)
#if (!$isInheritance)
                <property name="$attribute.name" 
type="$attribute.type.fullyQualifiedHibernateType">
            <column name="$attribute.columnName" not-null="$attribute.required" 
unique="$attribute.unique" 
sql-type="$attribute.sqlType"#if($attribute.columnIndex) 
index="$attribute.columnIndex"#end/>
        </property>
#else
                <property name="$attribute.name" 
type="$attribute.type.fullyQualifiedHibernateType">
            <column name="$attribute.columnName" not-null="false" 
unique="$attribute.unique" 
sql-type="$attribute.sqlType"#if($attribute.columnIndex) 
index="$attribute.columnIndex"#end/>
        </property>
#end
#end

> Hibernate <subclass> mapping conflicts with not-null constraints
> ----------------------------------------------------------------
>
>          Key: SPRING-30
>          URL: http://thecla.homeftp.net:8380/jira//browse/SPRING-30
>      Project: Spring Cartridge
>         Type: Bug
>     Reporter: Matthias Bohlen
>     Assignee: Chad Brandon

>
>
> There is a conflict in the default settings for inheritance mapping for 
> Hibernate entities. Our default inheritance strategy is "table per class 
> hierarchy". This strategy does not allow not-null constraints on the 
> generated database columns. If you map entities B and C into the table A, 
> where B and C are subclasses of A, and if you save an instance of B then the 
> columns for C have to be null.
> However, for the columns, we generate not-null constraints, like
>   <column name="PRICE" not-null="true" ...>
> This is illegal. A workaround would be to force the user to change his/her 
> model and mark all attributes of C as optional - this would be VERY ugly.
> I recommend a new method on an attribute facade that calculates the not-null 
> constraint from a mixture of information from the attribute and from the 
> owning entity.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://thecla.homeftp.net:8380/jira//secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to