Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA, JPQL and the lack of certain features.  RSS feed

Avor Nadal
Ranch Hand
Posts: 156
Java Netbeans IDE Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Although JavaRanch has appeared many times among the results of my searches on Google, this is my first message here. Finally I decided to register and see what happens. So, first, hello to you all .

For the last year I've been learning a little about EJB and the JPA. This took me to learn the ins and outs of the JPQL also. I've been "playing" a lot with this query language on JBoss (using the Hibernate's HQL implementation, of course) but have missed several features which I was used to in SQL... They don't exist. At least that's what the information from the official Sun/Oracle's guide states: . Basically there are 3 matters which irritate me a lot:

  • Not being able to SORT by index or alias, instead of by the attribute name. It's essential to order a column which results from an operation or a function, since it becomes anonymous.
  • Not being able to use CASE control structures. Very useful to get into one single column values coming from several JOINs, for example.
  • Not being able to use the ROUND function. Although you can round all the values of a column after querying, sometimes it's necessary to do it into a query's internal operation.

  • I just wanted to know your opinion about if they're strictly necessary or there are alternatives. Do you believe that JPA/JPQL will adopt these features some day? Because if it's a remote possibility, then, I don't see the point on restricting myself to use the official JPQL syntax, taking into account that Hibernate, OpenJPA and others support these features and much more, and that we're advocated to use specific vendor's functions.

    Thank you ;) .
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!