LINQ Tools for Java
今天先介绍工具:
1、JoSQL http://sourceforge.net/projects/josql/?source=navbar
JoSQL (Java Objects SQL) provides SQL capabilities for querying, ordering and grouping of collections of Java objects (POJOs). It allows a SQL statement to be applied to the collection of objects and the matching set returned, ordered and grouped.
官方介绍比较简单
可以参考官方manual:http://josql.sourceforge.net/manual/index.html
或者自己看源码。
2、Quaere http://quaere.codehaus.org/Home
目前该项目没有发布版本,官方说法是由于需求变更导致。
Quaere is an open source, extensible framework that adds a querying syntax reminiscent of SQL to Java applications. Quaere allows you to filter, enumerate and create projections over a number of collections and other queryable resources using a common, expressive syntax.
Quaere detaches queries from the query API used by different queryable resources such as databases, catalogs and other structured data, allowing one language to be used to query numerous resources.
Quaere的语法比较简单:
public class GettingStartedWithQuaere { public static void main() { City[] cities=City.ALL_CITIES; Iterable<City> largePopulations = from("city").in(cities). orderBy("city.getName()"). orderByDescending("city.getPopulation()"). select("city"); for (City city : largePopulations) { System.out.println(city); } } }
还可以和JPA结合:
SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory(); EntityManagerFactory entityManagerFactory = new EntityManagerFactoryImpl(sessionFactory, PersistenceUnitTransactionType.RESOURCE_LOCAL, true); QueryableEntityManager entityManager = new QueryableEntityManager(entityManagerFactory.createEntityManager()); // Select all customers in the Washington region Iterable<Customer> waCustomers = from("c").in(entityManager.entity(Customer.class)). where(eq("c.getRegion()", "WA")). select("c"); System.out.println("These customers are located in the Washington region:"); for (Customer c : waCustomers) { System.out.println(c.getCompanyName()); }
是不是很方便。
可以从svn上直接拖代码下来自己研究。
3、linq4j http://www.hydromatic.net/linq4j/
linq4j is a port of LINQ (Language-Integrated Query) to Java.
目前项目发布了一个快照版本,感兴趣的可以测试下,功能很强大。
相关推荐
ASP, which was designed as a quick-and-dirty set of tools for inserting dynamic content into ordinary web pages. By contrast, ASP.NET is a full-blown platform for developing comprehensive, ...
ASP, which was designed as a quick-and-dirty set of tools for inserting dynamic content into ordinary web pages. By contrast, ASP.NET is a full-blown platform for developing comprehensive, ...
ASP, which was designed as a quick-and-dirty set of tools for inserting dynamic content into ordinary web pages. By contrast, ASP.NET is a full-blown platform for developing comprehensive, ...
ASP, which was designed as a quick-and-dirty set of tools for inserting dynamic content into ordinary web pages. By contrast, ASP.NET is a full-blown platform for developing comprehensive, ...
- **.NET as a Reaction to the Java World**: Microsoft’s response to Sun Microsystems’ Java platform, aiming to provide a robust framework for building and running applications. - **The Open Source...
21. LINQ (Language Integrated Query) in .NET Framework allows querying, insertion, and modification of data, but not importing. 22. To set the tab order of controls on a Windows Form, you would use ...
C#的设计融合了C++和Java的优点,同时引入了许多现代编程概念,如垃圾回收、自动类型推断和匿名方法等。 该书可能会涵盖以下核心知识点: 1. **基础语法**:包括变量、数据类型、运算符、流程控制(如if语句、for...
1. **C#基础**:C#的基本语法结构与C++和Java类似,包括变量声明、数据类型(如int、float、bool)、控制流语句(if-else、for、while)以及函数定义。了解这些基础知识是完成任何C#任务的前提。 2. **类与对象**:...
C#语法与C++和Java有诸多相似之处,但也有其独特的特性。例如,C#支持命名空间(Namespaces),这有助于组织代码并避免命名冲突。类(Classes)是C#的核心,它们定义了对象的属性和行为。此外,C#还有结构体...
1. **基础语法**:C#的基本语法结构与C++和Java类似,包括变量声明、数据类型(如int、float、bool等)、控制结构(如if语句、for循环、while循环)以及函数定义。 2. **面向对象**:C#的核心是面向对象编程,支持...