We're updating the issue view to help you get more done. 

SUBSTRING example code suggests start position is 0-based

Description

The substring example code is in the documentation:

1 2 3 4 5 List<String> prefixes = entityManager.createQuery( "select substring( p.number, 0, 2 ) " + "from Call c " + "join c.phone p", String.class ) .getResultList();

However this example is slightly confusing in that it implies that start position is 0-based, while both SQL and JPA 2.1 (section 4.6.17.2.1) make clear it should be 1-based.

The example code should be updated to use start position 1, and the documentation should explicitly mention that it is 1-based.

Environment

None

Status

Assignee

Mark Rotteveel

Reporter

Mark Rotteveel

Components

Fix versions

Affects versions

5.2.7

Priority

Minor