Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
SQLQuery option for Statement.setFetchSize(int) #1419
On the other hand setters would be more intuitive than enum style - distinct methods work well with auto-complete whereas finding that kind of enum setters would require googling/documentation.
I would leave defaults as unset, null or empty Optional, for all of these. At least fetchSize might slow down other queries and there are other ways of defining timeouts. Instead of setting maxRows, most developers would/should use SQL based limit, etc. If, however, someone wants to use Querydsl for setting these at global level, then using a listener is not that hard.
Enum vs setters:
How about a StatementOptions immutable object. Default is created with default constructor, builder might be overkill. That way code can apply the same combination of options easily to many statements.
And I agree with ssaarela that defaults should be null or empty Optional. There are no values for the any of the settings that are good for all jdbc drivers.