Mocking JDBC Using a Set of SQL String / Result Pairs

In a previous blog post, I've shown how the programmatic MockDataProvider can be used to mock the entire JDBC API through a single functional interface: // context contains the SQL string and bind variables, etc. MockDataProvider provider = context -> { // This defines the update counts, result sets, etc. // depending on the context … Continue reading Mocking JDBC Using a Set of SQL String / Result Pairs

Hack up a Simple JDBC ResultSet Cache Using jOOQ’s MockDataProvider

Some queries shouldn't hit the database all the time. When you query for master data (such as system settings, languages, translations, etc.), for instance, you may want to avoid sending the same silly query (and the results) over the wire all the time. For example: SELECT * FROM languages Most databases maintain buffer caches to … Continue reading Hack up a Simple JDBC ResultSet Cache Using jOOQ’s MockDataProvider