nightstyles / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

JPAProducer ($filter) Type Functions #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
JPA 2.0 (JPQL) support type test (TYPE()), but current eclipselink 2.1.2 has a 
bug and the TYPE function does not work.

Original issue reported on code.google.com by sergei.inbox@gmail.com on 22 Dec 2010 at 10:40

GoogleCodeExporter commented 9 years ago
I just looked into it and found a problem. JPQL entity names are not strings - 
no quotes around. In JPQLGenerator.java replace

      // TODO: don't work, for me its bug in EclipseLink
      return String.format( "TYPE(%s) = '%s'", clazz, e.getType() );

with 
      return String.format( "TYPE(%s) = %s", clazz, e.getType() );

Tested with EclipseLink Indigo 2.3.0

Regards,
VG

Original comment by vgo...@gmail.com on 13 Oct 2011 at 8:28

GoogleCodeExporter commented 9 years ago
It doesn't seem to be as simple as this - does not work for me.  Can you 
elaborate on your odata filter queries that are fixed by dequoting the type 
name?

Original comment by john.spurlock on 15 Oct 2011 at 2:29