Easy database queries for Java
Jinq:
Easy Database Queries for Java

Jinq provides developers an easy and natural way to write database queries in Java. You can treat database data like normal Java objects stored in collections. You can iterate over them and filter them using normal Java commands, and all your code will be automatically translated into optimized database queries. Finally, LINQ-style queries are available for Java!

Simple Natural Queries.

With Jinq, you can write database queries using a simple, natural Java syntax. Using Java 8's new support for functional programming, you can filter and transform data in a database using the same code you would use for normal Java data.

For example, below is some Java code that uses Jinq to get a list of all the customers named "Alice" from a database.

database.customerStream().where(
  customer -> customer.getName().equals("Alice"));

The code

  1. Gets a stream of all the customers from a database
  2. Visits each customer object and filters them using a function
  3. Only customers named "Alice" are returned

When the code is executed in Java, Jinq will automatically convert the code into SQL queries that a database can understand.

PreparedStatement s = con.prepareStatement("SELECT * "
  + "FROM Customer C "
  + "WHERE C.Name = ? ");
s.setString(1, "Alice");
ResultSet rs = s.executeQuery();

Fewer Bugs. Fewer Security Mistakes. Faster Development.

Existing database queries are written inside strings. To check for errors, you must start up a database and run the queries. This slows development and leads to more bugs.

Jinq queries are normal Java code, and the Java compiler will catch bugs early, speeding your development. Since queries are written as Java code, common SQL injection security problems are impossible.

Try It Now

Jinq is open source. Download it now and follow the Getting Started guide to learn more about its features.

Visit Our Forum

Fork me on GitHub