Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during use NEW keyword for enum in loader query #3117

Closed
maistrenkoIulia opened this issue Dec 10, 2020 · 4 comments
Closed

Error during use NEW keyword for enum in loader query #3117

maistrenkoIulia opened this issue Dec 10, 2020 · 4 comments
Assignees
Labels
state: fixed Fixed by the developer type: bug Something isn't working ver: 7.2.14 Fixed in version ver: 7.3.0 Fixed in version
Milestone

Comments

@maistrenkoIulia
Copy link

see https://www.cuba-platform.com/discuss/t/enum-and-the-keyword-new-in-screen-xml/14177
enums.zip

Environment

CUBA Platform version: 7.2.10
CUBA Studio plugin version: 15.0.SNAPSHOT2679-202
IntelliJ version: IntelliJ IDEA 2020.2.4 (Community Edition)

Description of the bug or enhancement

  • Minimal reproducible example
  1. Launch attached project
  2. Open Cars browser
    ER: browser should be opened successfully and cars with status New, On_sale should be displayed
    AR:
JpqlSyntaxException: Errors found for input jpql:[select e from enums_Car e                     where e.status = @enum(com.company.enums.entity.Status.NEW)                     or e.status = @enum(com.company.enums.entity.Status.ON_SALE)]
CommonErrorNode [<unexpected: [@33,53:53='.',<68>,1:53], resync=e.status = @enum(com.company.enums.entity.Status.NEW)>]
@knstvk knstvk added the type: bug Something isn't working label Dec 14, 2020
@grenjen
Copy link

grenjen commented Apr 1, 2021

I just stumbled over the same error. In my case the error appears with the collection loader query

<![CDATA[select e from Department e where e.campaignType = @enum(com.company.DepartmentCampaignType.WEEK)]]>

while

<![CDATA[select e from Department e where e.campaignType = @enum(com.company.DepartmentCampaignType.CITY)]]>

works perfectly fine. In case it helps finding the cause of this unexpected behavior, here the enumeration class code:

enum class DepartmentCampaignType(private val id: String) : EnumClass<String> {
    WEEK("WEEK"),
    CITY("CITY");

    override fun getId() = id

    companion object {

        @JvmStatic
        fun fromId(id: String): DepartmentCampaignType? = values().find { it.id == id }
    }
}

@cdermcarter
Copy link

I have encountered the same issue but my enum is called GROUP.

NEW, WEEK, GROUP.

Could it be failing on use of JPQL reserved words?

@maistrenkoIulia
Copy link
Author

reproduced on
CUBA Platform version: 7.2-SNAPSHOT
CUBA Studio plugin version: 15.0.SNAPSHOT2727-202
IntelliJ version: IntelliJ IDEA 2021.1.3 (Community Edition)

plakhov added a commit that referenced this issue Jul 6, 2021
plakhov added a commit that referenced this issue Jul 6, 2021
plakhov added a commit that referenced this issue Jul 7, 2021
plakhov added a commit that referenced this issue Jul 7, 2021
@maistrenkoIulia
Copy link
Author

7.3 - ok
7.2 - NOK
enums.zip

@maistrenkoIulia maistrenkoIulia added the state: fixed Fixed by the developer label Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: fixed Fixed by the developer type: bug Something isn't working ver: 7.2.14 Fixed in version ver: 7.3.0 Fixed in version
Projects
None yet
Development

No branches or pull requests

9 participants