At work Java is our main programming language but its not so advance like C# (not to start a language war here!) one of them are LINQ but LINQ is also available in Java!
What Is LINQ?
Language Integrated Query (LINQ) was added to C# 3.0 / VB.Net 9.0 in MS Visual Studio.Net 2008. Its a query language part of the underline language for easy query of information like a database, online resources like a webservice or in our case collections (list, arrays, hashmaps etc). Different LINQ providers existing for collections, databases, Amazon, Facebook, Twitter, LDAP etc. Visit Wikipedia for more about LINQ.
Let's Meet: JoSQL
JoSQL is LINQ for Java that allow you to easily query collections (lists, arrays etc) using a SQL line syntax.
References
Disadvantages:
- No compile time checking since the LINQ code will only be evaluated when query.parse() method get called at run-time.
- You need to indicate the full package + class name in your query
- If you wish to use "NOT IN" or "IN" in the WHERE clause then you need to override the toString() method of the class since it needs to know which field to use to do the comparison with.
I will write more JoSQL samples in the next weekly source code. Also my solution to the toString() problem.
1 comment:
For a typesafe approach to LINQ for Java, consider Querydsl
Querydsl supports JPA/Hibernate, JDO, SQL and Collections as backend and has a fully typesafe syntax like LINQ.
Post a Comment