Streamed SQL

I just saw that I never posted this here on my blog. JDBC is still a good way to just connect to some SQL database where JPA would be overkill. So I wrote a library that allows you to use the Java Stream API to process that data.

The Code is on GitHub:

https://github.com/claudemartin/streamed-sql

Example Code:

Connection conn = dbpool.getConnection();
var strsql = StreamedSQL.create(conn, true); 
try (Stream<Foo> stream = strsql.stream("SELECT * FROM FOO", Foo::new)) {
  stream.filter(f -> f.getName().startsWith("L")).sorted().forEachOrdered(System.out::println);
}

Leave a Reply

Your email address will not be published. Required fields are marked *