You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Jan Penninkhof (JIRA)" <ji...@apache.org> on 2016/02/23 01:50:18 UTC
[jira] [Updated] (OLINGO-891) Use only two parameters in CONCAT
function of JPA Where Expressions
[ https://issues.apache.org/jira/browse/OLINGO-891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Penninkhof updated OLINGO-891:
----------------------------------
Description:
Substring filters such as the one below:
{code}
$filter=(substringof(%27Jan%27,FirstName)
{code}
Are translated into JPA where clauses similar to:
{code}
Where case when last_name like concat('%', 'Jan', '%') then 1 else 0 end=1
{code}
However, not all database support concat functions with more than 2 parameters. The SAP Hana database is one of them.
I would propose to turn the where clause into:
{code}
Where case when last_name like concat('%', concat('Jan', '%')) then 1 else 0 end=1
{code}
to get the clause to run on more database platforms.
was:
Substring filters such as the one below:
$filter=(substringof(%27Jan%27,FirstName)
Are translated into JPA where clauses similar to:
Where case when last_name like concat('%', 'Jan', '%') then 1 else 0 end=1
However, not all database support concat functions with more than 2 parameters. The SAP Hana database is one of them.
I would propose to turn the where clause into:
Where case when last_name like concat('%', concat('Jan', '%')) then 1 else 0 end=1
to get the clause to run on more database platforms.
> Use only two parameters in CONCAT function of JPA Where Expressions
> -------------------------------------------------------------------
>
> Key: OLINGO-891
> URL: https://issues.apache.org/jira/browse/OLINGO-891
> Project: Olingo
> Issue Type: Bug
> Components: odata2-jpa
> Affects Versions: V2 2.0.6
> Reporter: Jan Penninkhof
> Fix For: V2 2.0.7
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> Substring filters such as the one below:
> {code}
> $filter=(substringof(%27Jan%27,FirstName)
> {code}
> Are translated into JPA where clauses similar to:
> {code}
> Where case when last_name like concat('%', 'Jan', '%') then 1 else 0 end=1
> {code}
> However, not all database support concat functions with more than 2 parameters. The SAP Hana database is one of them.
> I would propose to turn the where clause into:
> {code}
> Where case when last_name like concat('%', concat('Jan', '%')) then 1 else 0 end=1
> {code}
> to get the clause to run on more database platforms.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)