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?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
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.
Have a look at JaQue.
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.
For database-heavy work, SQLJ might be an option. The downside is it's not pure Java and requires a pre-processor.
You won't find an equivalent of LINQ unless you use the javacc to create your own equivalent.
Until that day when someone finds a viable way to do so, there are some good alternatives, such as
There is no exact alternative which is universal as LINQ is. However if we are talking about LINQ to SQL then JPA is really an alternative when you use it with an IDE that supports "Inject language" feature. E.g. IDEA will do full scale completion of the JPA query within a string