[ 
https://issues.apache.org/jira/browse/OPENJPA-2242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla resolved OPENJPA-2242.
--------------------------------------
    Resolution: Fixed

Already fixed on master: c3169ccf3 (OPENJPA-2242, on master) adds 
getCastStringColumnSize (DB2Dictionary.java:1061), which widens the cast to the 
literal length; addCastAsType, appendSelect and appendCast all use it 
(DB2Dictionary.java:234,788,920). Closing; please reopen if this still happens 
with OpenJPA 4.x.

> Hard coded column size in CAST(? AS VARCHAR(254)) for DB2 caused runtime 
> failure
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2242
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2242
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.0.1, 2.1.2, 2.2.1, 2.3.0
>            Reporter: Albert Lee
>            Assignee: Albert Lee
>            Priority: Major
>         Attachments: OPENJPA-2242.patch
>
>
> When procedure call is used in criteria builder as described in the following 
> code snippet,
> a hard coded column size in CAST(? AS VARCHAR(#)) for DB2 is generated and 
> caused run-time failure with a SQLCODE=-302, SQLSTATE=22001 
>       CriteriaBuilder cb = em.getCriteriaBuilder();
>       CriteriaQuery<SimpleEntity> criteriaQuery = 
> cb.createQuery(SimpleEntity.class);
>       Root<SimpleEntity> simpleEntity = 
> criteriaQuery.from(SimpleEntity.class);
>       Expression<String> func1 = null;
>       Expression<Double> func2 = null;
>       func2 = cb.function(
>               "st_point",
>               Double.class,
>               cb.literal("abcd......"), // error if String.length > 254
>               cb.literal(1003));
>       }



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to