views:

1302

answers:

6

Having played with Linq (to SQL and Objects) as well as the Entity Framework from Microsoft recently, I was wondering what the non-.Net (specifically Java) equivalents are?

+2  A: 

Java does not have a Linq equivalent. However Scala, a functional language that compiles to Java byte code, has something closes: an extended for loop syntax.

landon9720
+5  A: 

You might want to check out the quaere project. Its a java framework that adds a way to query collections, similar to how LINQ works.

nstehr
Looks pretty interesting, and it can be layered on top of JPA too. It's pre-beta though (http://quaere.codehaus.org/Getting+started).
Jim Ferrans
+3  A: 

There is a Java project called JoSQL which provides object querying capabilities with a SQL-like syntax.
While I haven't used it myself, I know that it is used in some heavyweight applications.

hasalottajava
This looks pretty interesting. It's not a database tool, but a way to use SQL to operate on Java objects (like LINQ to Objects).
Jim Ferrans
+1  A: 

Have a look at JaQue.

Apocalisp
Better link: http://code.google.com/p/jaque/
Jim Ferrans
+1  A: 

For database-heavy work, SQLJ might be an option. The downside is it's not pure Java and requires a pre-processor.

ykaganovich
+8  A: 

Consider using Querydsl : http://source.mysema.com/display/querydsl/Querydsl

It supports JPA/Hibernate, JDO, SQL and Collections.

Querydsl is fully type-safe, supports autocomplete in IDEs and provides a common querying syntax on top multiple backends.

I am the maintainer of Querydsl, and I wrote a comparison to other frameworks some time ago.

It is slightly biased, but shows the different emphasis

  • statically typed or not
  • which backends are supported
  • is the interface for query construction cascading or not

Newer frameworks experiment also with closure syntax.

Timo Westkämper
Why is this being flagged as spam? As far as I can see answers the question.
Yacoby
@Yacoby, see http://meta.stackoverflow.com/questions/50038/it-doesnt-matter-what-the-question-is-theres-only-one-answer (which has been resolved by Timo nicely, in my opinion)
Arjan