Skip to content

Positional parameter should start at 1 #33

Description

@dmainardi

Jakarta EE 11, Eclipse Glassfish 8.0.2, OmniPersistence 1.0

When I call the method findFirst("WHERE e.type = ?1", type) Glassfish raises the following exception
java.lang.IllegalArgumentException: You have attempted to set a parameter at position 0 which does not exist in this query string SELECT e FROM Configuration e WHERE e.type = ?1.

I think the problem might be in org.omnifaces.persistence.serviceBaseEntityService::setPositionalParameters:
instead of
range(0, positionalParameters.length).forEach(i -> typedQuery.setParameter(i, positionalParameters[i]));
it should be written
range(0, positionalParameters.length).forEach(i -> typedQuery.setParameter(i + 1, positionalParameters[i]));

Thanks

Davide

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions