Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'column()' function #595

Open
gavinking opened this issue Mar 16, 2024 · 0 comments
Open

'column()' function #595

gavinking opened this issue Mar 16, 2024 · 0 comments

Comments

@gavinking
Copy link
Contributor

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:

  • drop the requirement that column/function names be quoted, at least in the overwhelmingly common case that they are legal JPQL identifiers, and
  • add a way to specify the type of the column or function.

So I would allow:

  • column(a.column_name as String)
  • function(funname as Double, a.x, b.y)

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

  • sql('(? <-> ?)' as Boolean, a.x, b.y)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant