This Common API Technique is Actually an Anti-Pattern

I admit, we've been lured into using this technique as well. It's just so convenient, as it allows for avoiding a seemingly unnecessary cast. It's the following technique here: interface SomeWrapper { <T> T get(); } Now you can type safely assign anything from the wrapper to any type: SomeWrapper wrapper = ... // Obviously … Continue reading This Common API Technique is Actually an Anti-Pattern

Do Not Think That One Second is Fast for Query Execution

I keep encountering situations where RDBMS users think that one second for query execution is anything near fast. Most recently, in this Stack Overflow question: Hibernate SQL In clause making CPU usage to 100% The poster's original question was why a similar query executes in one second when executed in SQL Server Management Studio whereas … Continue reading Do Not Think That One Second is Fast for Query Execution

Let’s Review How to Insert Clob or Blob via JDBC

LOBs are a PITA in all databases, as well as in JDBC. Handling them correctly takes a couple of lines of code, and you can be sure that you'll get it wrong eventually. Because you have to think of a couple of things: Foremost, LOBs are heavy resources that need special lifecycle management. Once you've … Continue reading Let’s Review How to Insert Clob or Blob via JDBC

Is Your Eclipse Running a Bit Slow? Just Use This Simple Trick!

You wouldn't believe it until you try it yourself. I've been using the Eclipse Mars developer milestones lately, and I've been having some issues with slow compilation. I always thought it was because of the m2e integration, which has never been famous for working perfectly. But then, it dawned upon me when I added a … Continue reading Is Your Eclipse Running a Bit Slow? Just Use This Simple Trick!

How JPA 2.1 has become the new EJB 2.0

Beauty lies in the eye of the beholder. So does "ease": https://twitter.com/thjanssen123/status/588212182225039361 Thorben writes very good and useful articles about JPA, and he's recently started an excellent series about JPA 2.1's new features. Among which: Result set mapping. We can summarise this mapping procedure as follows: a) define the mapping @SqlResultSetMapping( name = "BookAuthorMapping", entities … Continue reading How JPA 2.1 has become the new EJB 2.0

jOOQ Tuesdays: Vlad Mihalcea Gives Deep Insight into SQL and Hibernate

Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective. This includes people who work with SQL, Java, Open Source, and a variety of other related topics. We have the pleasure … Continue reading jOOQ Tuesdays: Vlad Mihalcea Gives Deep Insight into SQL and Hibernate

It’s the Little Things: The PL/SQL NULL Statement, and why Every Language Should have One

Syntax is one of those topics. One of those emotional topics that lead to very very very important discussions. I personally like PL/SQL. It is extremely verbose, and precise. It forces you to adhere to a very strong and rigid type system, slowing you down, which is likely to help you avoid mistakes. There is … Continue reading It’s the Little Things: The PL/SQL NULL Statement, and why Every Language Should have One

How to FlatMap a JDBC ResultSet with Java 8?

You're not into the functional mood yet? Then the title might not resonate with you - but the article will! Trust me. Essentially, we want this: +------+------+------+ | col1 | col2 | col3 | +------+------+------+ | A | B | C | row 1 | D | E | F | row 2 | G … Continue reading How to FlatMap a JDBC ResultSet with Java 8?

How to Avoid the Dreaded Dead Lock when Pessimistic Locking – And some Awesome Java 8 Usage!

Sometimes you simply cannot avoid it: Pessimistic locking via SQL. In fact, it's an awesome tool when you want to synchronise several applications on a shared, global lock. Some may think this is abusing the database. We think use the tools you have if they can solve the problem you have. For instance, the RDBMS … Continue reading How to Avoid the Dreaded Dead Lock when Pessimistic Locking – And some Awesome Java 8 Usage!

How to Use Java 8 Streams to Swiftly Replace Elements in a List

Imagine you have a list of items: List<String> books = Arrays.asList( "The Holy Cow: The Bovine Testament", "True Hip Hop", "Truth and Existence", "The Big Book of Green Design" ); (Don't judge me. Books from this random book generator) Now you'd like to create a new list where the third item only is replaced by … Continue reading How to Use Java 8 Streams to Swiftly Replace Elements in a List