jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
186 stars 55 forks source link

'column()' function #595

Open gavinking opened 3 months ago

gavinking commented 3 months ago

EclipseLink has a column() function, which is very similar in nature to the function() function which is already in JPQL. [That's because function() came directly from TopLink.] I think it would be nice to add that to JPQL.

EclipseLink and Hibernate also both have a sql() function, allowing arbitrary fragments of SQL, with almost identical syntax. [Because Hibernate copied EclipseLink, I believe.] We could consider including this one too.

The only wrinkle is that I would like to make two improvements:

So I would allow:

If we wanted to also allow sql, the full syntax would be something like:

but I think this one is a bit more complex and more difficult to specify. I'm not sure it's worth adding.