You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Robert Zeigler (JIRA)" <ji...@apache.org> on 2009/04/24 18:44:30 UTC

[jira] Created: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

Cayenne should support enum types in qualifier statements/expression handling
-----------------------------------------------------------------------------

                 Key: CAY-1213
                 URL: https://issues.apache.org/jira/browse/CAY-1213
             Project: Cayenne
          Issue Type: Improvement
          Components: Cayenne Core Library
    Affects Versions: 3.0M5
            Reporter: Robert Zeigler
            Assignee: Robert Zeigler


Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.

Enum expressions would look like:

propertyName = some.package.Type.CONSTANT

to make it consistent with JPA.

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


[jira] Commented: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12911183#action_12911183 ] 

Andrus Adamchik commented on CAY-1213:
--------------------------------------

Andrei, I applied the patch. Looks good. One thing that I had to change is the use of StringUtils. Looks like commons-lange library leaked into Cayenne via Velocity, although Cayenne itself doesn't (and shouldn't) have a dependency on commons-lang. So I replaced with with a simple 'indexOf' lookup, which should also perform better, as it doesn't do cloning or regex matching, just a simple substring.

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Commented: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12834809#action_12834809 ] 

Andrus Adamchik commented on CAY-1213:
--------------------------------------

Ksenia looked at this a bit , and it turns out that:

1. Our EJBQL implementation doesn't process enums properly.
2. In Expression API (unless we decide to add a special prefix for enums), there is a syntactic ambiguity between a relationship path and an enum. 

For now the plan is to fix #1 and keep the #2 ambiguity, resolving it when expression is processed. I.e. ASTPath can be a path or an enum.

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Robert Zeigler
>             Fix For: Undefined future
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Updated: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrei Veprev updated CAY-1213:
-------------------------------

    Attachment: CAY-1213-in-memory.patch

And small patch for in-memory evaluation implementation.

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213-ejbql.patch, CAY-1213-in-memory.patch, CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Assigned: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrus Adamchik reassigned CAY-1213:
------------------------------------

    Assignee: Andrus Adamchik  (was: Robert Zeigler)

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Commented: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910521#action_12910521 ] 

Andrus Adamchik commented on CAY-1213:
--------------------------------------

Andrei, before I look closer at the patch, a few high level observations:

* would be nice to collapse multiple git revisions into one in a patch. (not that I can't do it myself on my end :-))
* In the test cases, let's rename entity User to something less common that can't potentially be a DB keyword, etc. 

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Updated: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrei Veprev updated CAY-1213:
-------------------------------

    Attachment: CAY-1213-ejbql.patch

Here is new patch. It implements requared functionality for EJBQL queries.

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213-ejbql.patch, CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Closed: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrus Adamchik closed CAY-1213.
--------------------------------

    Fix Version/s: 3.1M1
                       (was: Undefined future)
       Resolution: Fixed

Andrei, thanks for the patches. I applied them pretty much unchanged, and everything works correctly. 

A note on Cayenne code conventions (since I don't have any substantial comments on the actual patch contents :-)) - any new public or protected API (such as new methods), we tag with major Cayenne version when it was added. So I added "@since 3.1" to a few new public methods.  

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: 3.1M1
>
>         Attachments: CAY-1213-ejbql.patch, CAY-1213-in-memory.patch, CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Commented: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

Posted by "Andrei Veprev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12911188#action_12911188 ] 

Andrei Veprev commented on CAY-1213:
------------------------------------

Ok, got it :)

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Updated: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrei Veprev updated CAY-1213:
-------------------------------

    Attachment: CAY-1213.patch

Here is the patch that implements enum and constant (static final) values in expressions. To specify const value in expression user have to provide full path to it: some.package.Type.CONSTANT.
This patch doesn't implement such functionality for EJBQL.
There is problem with null values: in case if constant value is null wrong qualifier is generated for SQL statement (such as "someField = NULL" instead of  "someField IS NULL").

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Updated: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrei Veprev updated CAY-1213:
-------------------------------

    Attachment:     (was: CAY-1213.patch)

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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


[jira] Updated: (CAY-1213) Cayenne should support enum types in qualifier statements/expression handling

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

Andrei Veprev updated CAY-1213:
-------------------------------

    Attachment: CAY-1213.patch

Ok, here it is.
Renamed User entity to Cons1Entity. And "one-commit" patch.

> Cayenne should support enum types in qualifier statements/expression handling
> -----------------------------------------------------------------------------
>
>                 Key: CAY-1213
>                 URL: https://issues.apache.org/jira/browse/CAY-1213
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0M5
>            Reporter: Robert Zeigler
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>         Attachments: CAY-1213.patch
>
>
> Currently, cayenne doesn't support java enums in its expression syntax and, by extension, in qualifier statements.  This makes it impossible to use an enum type as a class descriminator for inheritance.
> Enum expressions would look like:
> propertyName = some.package.Type.CONSTANT
> to make it consistent with JPA.

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