What are the Java equivalents to Linq and Entity F

2020-05-20 02:22发布

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?

8条回答
乱世女痞
2楼-- · 2020-05-20 02:42

Consider using Querydsl : http://www.querydsl.com

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.

查看更多
老娘就宠你
3楼-- · 2020-05-20 02:46

For LINQ (LINQ to Objects to be more accurate) you can use Streams starting from Java 8

This doesn't work for databases however, only for internal objects like Collections and Lists

It is really powerfull, but not as complete as LINQ (in my opinion)

Check out this tutorial - http://www.oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html

As for Entity Framework there is nothing quite as powerful that I have found yet, but haven't tried all the solutions provided in the other answers

查看更多
登录 后发表回答