Replace non-null with nullable instead of optional
--------------------------------------------------

                 Key: OPENJPA-1825
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1825
             Project: OpenJPA
          Issue Type: Sub-task
          Components: tooling
    Affects Versions: 2.0.0
         Environment: WinXP
            Reporter: Lucas Partridge


Currently the migration tool (which is very useful!) replaces the 'not-null' 
attribute of Hibernate's 'property' with the 'optional' attribute for OpenJPA.  
However, when using runtime forward mapping with the resulting orm file the 
generated DDL doesn't recognise the value of the optional attribute.  The 
database column has IS_NULL = YES.

So the first thing is, can we please replace this section in 
migration-actions.xml for the 'property' action:

        <rename-attr from="not-null" to="optional">
                <map-value from="true"  to="false"/>
                <map-value from="false" to="true"/>
        </rename-attr>
with:
    <promote-attr from="column" to="column" as="name">
 ....
      <consume-attr from="not-null" to="nullable">
        <map-value from="true"  to="false"/>
        <map-value from="false" to="true"/>
      </consume-attr>
    </promote-attr>

...because the nullable attribute is honoured by the DDL as required (e.g., 
nullable="false" becomes IS_NULL=NO in the db).

The second thing is that when I do this the values don't get reveresed as 
expected.  For example, the following Hibernate line:

<property name="value" column="VALUE" type="text" length="10000000" 
not-null="true"/>

becomes:

      <basic name="value">
        <column length="10000000" name="VALUE" nullable="true"/>
      </basic>

...instead of the expected nullable="false".  Have you tested map-value 
elements when they're embedded inside consume-attr elements?  It looks like 
it's not working there.  They do appear to work however when inside rename-attr 
elements.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to