Annotatiomania™, or why did Hibernate/JPA get so complex?

I was curious about good answers to this question on Stack Overflow:

And a good answer came up, pointing at this Hibernate documentation page:

Is anyone out there actually willing to mess around with gazillions of annotations on simple methods? Who ever writes this stuff:

public class User {
   public String getLastname() { ...}

   public Set<Address> getAddresses() { ... }

public class Address {
   public String getStreet1() {...}

Do some developers despise SQL so much that they’re willing to put up with “annotatiomania”? Whatever happened with the good old

SELECT u.first_name, u.last_name, a.street1
FROM users u
JOIN addresses a ON a.user_id =

Guys. If a technology starts doing things like “@AttributeOverrides”, then something IS smelling fishy

Oracle scalar subquery caching

The importance of being able to fully control executed SQL (using jOOQ, or plain JDBC) on large-scale systems becomes obvious every time you need to fine-tune your SQL queries for a specific RDBMS. In this case, we’re looking at Oracle and its miraculous scalar subquery caching mechanisms:

Usually, the context switch from SQL to PL/SQL and back is quite expensive for an average Oracle query, so we should normally omit putting stored functions as filtering, grouping, sorting criteria, even if they’re DETERMINISTIC. When we have large result sets, however, even functions in the query projection may turn out to be an execution plan nightmare. I recently raised the question on Stack Overflow, as I’m curious if there is any caching mechanism, that I could take advantage of for a concrete use-case:

And most interestingly, there are several. The accepted answer points to this very relevant article on Ask Tom’s Q/A:

Apparently, in scalar subqueries, function results may be cached! While this can be very useful for performance, it can also be very dangerous for consistency – as with any caching mechanism, but this one is highly implicit! So this will be cached:

-- my_function is NOT deterministic but it is cached!
select t.x, t.y, (select my_function(t.x) from dual)
from t

-- logically equivalent to this, uncached
select t.x, t.y, my_function(t.x) from t

Knowing this, I think I have to review quite a bit of SQL…