Type something to search...
Java Recipes - Part 1
src - GC Libraries Creative Tech Lab @ Unsplash

Java Recipes - Part 1

You can store large JSON/String objects in RDBMS with blob. Oracle DB recommends blob for storing JSON objects. In this article, we’ll learn it how to handle it using JPA.

Using iterator index in lambda inside forEach

You can make use of streams as shown below:

// For setting the parameters in prepared statement query
// params is ArrayList contains the parameter values in same order, ? appears in query (implicit index)
IntStream.range(1, params.size() + 1)
          .forEach(idx -> q.setParameter(idx, params.get(idx - 1)));
// OR
AtomicInteger idx = new AtomicInteger();
params.forEach(e -> q.setParameters(idx.incrementAndGet(), e));

Related Posts

Handling of blob in JPA and JDBC

Handling of blob in JPA and JDBC

You can store large JSON/String objects in RDBMS with blob. Oracle recommends blob for storing JSON objects. In this article, we'll learn it how to handle it using JPA.

read more
Javascript Tidbits

Javascript Tidbits

A list of javascript concepts that one must know or have some tricks - like call/apply, Intl.ListFormat.

read more
Java Features

Java Features

It is very difficult to recollect, which feature was released in which Java version. Specifically, after 6 months release cycle. This page tracks the Java features release in version 8 or later. There are few features with examples.

read more