Hi Alan, Have you tried doing the CASTs in concat function with Ingres?
OpenJPA generally produces SQL with parameters even if the corresponding JPQL is actually a constant. Only in a few places constants are inlined into SQL, e.g. substring method does this (and I can see you leveraged this also in your dictionary). Greetings, Milosz > I see that Derby produces the SQL: > > SELECT (CAST(t0.name AS VARCHAR(1000)) || CAST(? AS VARCHAR(1000))) AS cname > FROM Game t0 ORDER BY cname DESC [params=(String) 123] > > Which is virtually identical, so this seems to be a problem with Ingres. > > Alan > > > -----Original Message----- > > From: Alan Raison [mailto:[email protected]] > > Sent: 05 August 2009 10:24 > > To: [email protected] > > Subject: Help understanding JPQL Parsing > > > > Hi All > > > > I've been running the unit tests against Ingres and now have a 93% pass > > rate :) > > > > One problem I'm having is with the test > > o.a.o.persistence.jdbc.query.TestOrderByQuery.testOrderByConcatAliasDes > > c > > ending(). > > > > The JPQL in the test: > > > > "SELECT CONCAT(p.name, '123') as cname FROM Game p ORDER BY cname DESC" > > > > creates the SQL: > > > > "SELECT (t0.name + ?) AS cname FROM Game t0 ORDER BY cname DESC" > > > > Unfortunately, Ingres doesn't like the expression (col + ?), since it > > can't resolve the type. > > > > Does anyone know why this value isn't being substituted in to the SQL? > > I see in SQLBuffer there's a getSQL() method which takes a parameter to > > substitute in parameter values - how can this be used? > > > > Thanks > > Alan >
