Skip to content

Commit 67a9878

Browse files
committed
Java/Jinq: Add README as a stub
1 parent 538e160 commit 67a9878

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

by-language/java-jinq/README.rst

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.. highlight:: sh
2+
3+
############################################################
4+
Java Jinq demo application for CrateDB using PostgreSQL JDBC
5+
############################################################
6+
7+
8+
Jinq - Simple Natural Queries with Java.
9+
10+
11+
*****
12+
About
13+
*****
14+
15+
In a nutshell
16+
=============
17+
18+
A demo application using `CrateDB`_ with `Jinq`_ and the `PostgreSQL
19+
JDBC driver`_.
20+
It is intended as a basic example to demonstrate what works, and what not.
21+
Currently, it is only a stub. Contributions are welcome.
22+
23+
Introduction
24+
============
25+
26+
`Jinq`_ and `jOOQ`_ are in a similar area like `LINQ`_. We've picked up and
27+
summarized a few quotes from blog posts and interviews by Dr. Ming-Yee Iu and
28+
Lukas Eder, the main authors of Jinq and jOOQ.
29+
30+
Firstly, you may enjoy the guest post by Dr. Ming-Yee Iu `Java 8 Will
31+
Revolutionize Database Access`_, which outlines how adding functional-support
32+
to the Java language version 8 made a difference while aiming to write database
33+
inquiries more fluently at that time (2014).
34+
35+
Ever since Erik Meijer has introduced LINQ to the .NET ecosystem, us Java
36+
folks have been wondering whether we could have the same.
37+
38+
Two years later, Dr. Ming-Yee Iu gives an `insight into Language Integrated
39+
Querying`_ at the `jOOQ Tuesdays series`_.
40+
41+
LINQ makes a lot of sense for the C# ecosystem, but I think it is totally
42+
inappropriate for Java.
43+
44+
Fortunately, Java programmers can use libraries such as Jinq and jOOQ
45+
instead, which provide most of the benefits of LINQ but don’t require tight
46+
language integration like LINQ.
47+
48+
Details
49+
=======
50+
51+
From the documentation at http://www.jinq.org/, about what Jinq actually is,
52+
and does.
53+
54+
Jinq provides developers an easy and natural way to write database queries
55+
in Java. You can treat database data like normal Java objects stored in
56+
collections. You can iterate over them and filter them using normal Java
57+
commands, and all your code will be automatically translated into optimized
58+
database queries. Finally, LINQ-style queries are available for Java!
59+
60+
With Jinq, you can write database queries using a simple, natural Java
61+
syntax. Using Java 8's new support for functional programming, you can
62+
filter and transform data in a database using the same code you would use
63+
for normal Java data.
64+
65+
66+
********
67+
Synopsis
68+
********
69+
70+
The idea of Jinq is to write database queries using a simple, natural Java
71+
syntax based on the functional programming support added with Java 8. Accessing
72+
a database table using the Jinq API looks like this:
73+
74+
.. code-block:: java
75+
76+
// Fetch records, with filtering and sorting, result iteration and printing.
77+
customers()
78+
.where(c -> c.getCountry().equals("UK"))
79+
.sortedDescendingBy(c -> c.getSalary())
80+
.forEach(c -> out.println(c.getName() + " " + c.getSalary()));
81+
82+
A few other concise `Jinq code examples`_ can be discovered at the Jinq code
83+
base.
84+
85+
86+
87+
.. _CrateDB: https://github.com/crate/crate
88+
.. _Jinq code examples: https://github.com/my2iu/Jinq/blob/main/sample/src/com/example/jinq/sample/SampleMain.java
89+
.. _Insight into Language Integrated Querying: https://blog.jooq.org/jooq-tuesdays-ming-yee-iu-gives-insight-into-language-integrated-querying/
90+
.. _Java 8 Will Revolutionize Database Access: https://blog.jooq.org/java-8-friday-java-8-will-revolutionize-database-access/
91+
.. _Jinq: https://github.com/my2iu/Jinq
92+
.. _jOOQ: https://github.com/jOOQ/jOOQ
93+
.. _jOOQ Tuesdays series: https://www.jooq.org/tuesdays
94+
.. _LINQ: https://en.wikipedia.org/wiki/Language_Integrated_Query
95+
.. _PostgreSQL JDBC Driver: https://github.com/pgjdbc/pgjdbc

0 commit comments

Comments
 (0)