You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Bob Morley (JIRA)" <ji...@apache.org> on 2009/11/04 19:43:33 UTC

[jira] Created: (OFBIZ-3154) When an entityModel has a field marked as a primary key, it should also be set to NotNull

When an entityModel has a field marked as a primary key, it should also be set to NotNull
-----------------------------------------------------------------------------------------

                 Key: OFBIZ-3154
                 URL: https://issues.apache.org/jira/browse/OFBIZ-3154
             Project: OFBiz
          Issue Type: Bug
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Bob Morley


We were doing some work with the ModelField and noticed that when a field is marked as a primary key it can still have its "NotNull" property set to "false" (the default).  Because we were doing work based on if a field was nullable it was causing a bug on primary keys.  The suggestion is to set NotNull = "true" when a field is marked as a primary key.  This should have no impact to current code as (in most places) a redundant check was being done (see creation of tables where it will add "NOT NULL" based on both isNotNull and isPk -- ideally it should be just based on the former).

This change makes minor modifications to two files ModelField and ModelEntity.  ModelField.setIsPk() will call setIsNotNull(true) when the primary key indicator is true.  ModelEntity will call field.isNotNull = true when it is reading the primary key elements in the entity definition.

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


[jira] Updated: (OFBIZ-3154) When an entityModel has a field marked as a primary key, it should also be set to NotNull

Posted by "Bob Morley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-3154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Morley updated OFBIZ-3154:
------------------------------

    Attachment: OFBIZ-3154_SetIsNotNullWhenAModelFieldIsAPrimaryKey.patch

> When an entityModel has a field marked as a primary key, it should also be set to NotNull
> -----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-3154
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3154
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3154_SetIsNotNullWhenAModelFieldIsAPrimaryKey.patch
>
>
> We were doing some work with the ModelField and noticed that when a field is marked as a primary key it can still have its "NotNull" property set to "false" (the default).  Because we were doing work based on if a field was nullable it was causing a bug on primary keys.  The suggestion is to set NotNull = "true" when a field is marked as a primary key.  This should have no impact to current code as (in most places) a redundant check was being done (see creation of tables where it will add "NOT NULL" based on both isNotNull and isPk -- ideally it should be just based on the former).
> This change makes minor modifications to two files ModelField and ModelEntity.  ModelField.setIsPk() will call setIsNotNull(true) when the primary key indicator is true.  ModelEntity will call field.isNotNull = true when it is reading the primary key elements in the entity definition.

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


[jira] Closed: (OFBIZ-3154) When an entityModel has a field marked as a primary key, it should also be set to NotNull

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-3154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-3154.
----------------------------------

    Resolution: Fixed

> When an entityModel has a field marked as a primary key, it should also be set to NotNull
> -----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-3154
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3154
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3154_SetIsNotNullWhenAModelFieldIsAPrimaryKey.patch
>
>
> We were doing some work with the ModelField and noticed that when a field is marked as a primary key it can still have its "NotNull" property set to "false" (the default).  Because we were doing work based on if a field was nullable it was causing a bug on primary keys.  The suggestion is to set NotNull = "true" when a field is marked as a primary key.  This should have no impact to current code as (in most places) a redundant check was being done (see creation of tables where it will add "NOT NULL" based on both isNotNull and isPk -- ideally it should be just based on the former).
> This change makes minor modifications to two files ModelField and ModelEntity.  ModelField.setIsPk() will call setIsNotNull(true) when the primary key indicator is true.  ModelEntity will call field.isNotNull = true when it is reading the primary key elements in the entity definition.

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


[jira] Commented: (OFBIZ-3154) When an entityModel has a field marked as a primary key, it should also be set to NotNull

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773610#action_12773610 ] 

Jacques Le Roux commented on OFBIZ-3154:
----------------------------------------

This makes sense indeed

> When an entityModel has a field marked as a primary key, it should also be set to NotNull
> -----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-3154
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3154
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3154_SetIsNotNullWhenAModelFieldIsAPrimaryKey.patch
>
>
> We were doing some work with the ModelField and noticed that when a field is marked as a primary key it can still have its "NotNull" property set to "false" (the default).  Because we were doing work based on if a field was nullable it was causing a bug on primary keys.  The suggestion is to set NotNull = "true" when a field is marked as a primary key.  This should have no impact to current code as (in most places) a redundant check was being done (see creation of tables where it will add "NOT NULL" based on both isNotNull and isPk -- ideally it should be just based on the former).
> This change makes minor modifications to two files ModelField and ModelEntity.  ModelField.setIsPk() will call setIsNotNull(true) when the primary key indicator is true.  ModelEntity will call field.isNotNull = true when it is reading the primary key elements in the entity definition.

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


[jira] Commented: (OFBIZ-3154) When an entityModel has a field marked as a primary key, it should also be set to NotNull

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776911#action_12776911 ] 

Jacques Le Roux commented on OFBIZ-3154:
----------------------------------------

Thanks Bob,

Your patch is in trunk at r835303. I did not backport to R9.04 as I don't consider this is really a bug (OFBiz lives with it for years). I will if the community thinks otherwise...

> When an entityModel has a field marked as a primary key, it should also be set to NotNull
> -----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-3154
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3154
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3154_SetIsNotNullWhenAModelFieldIsAPrimaryKey.patch
>
>
> We were doing some work with the ModelField and noticed that when a field is marked as a primary key it can still have its "NotNull" property set to "false" (the default).  Because we were doing work based on if a field was nullable it was causing a bug on primary keys.  The suggestion is to set NotNull = "true" when a field is marked as a primary key.  This should have no impact to current code as (in most places) a redundant check was being done (see creation of tables where it will add "NOT NULL" based on both isNotNull and isPk -- ideally it should be just based on the former).
> This change makes minor modifications to two files ModelField and ModelEntity.  ModelField.setIsPk() will call setIsNotNull(true) when the primary key indicator is true.  ModelEntity will call field.isNotNull = true when it is reading the primary key elements in the entity definition.

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