Remember that post about Typesafe DSLs that had a part one and no follow up? Well, meanwhile Juhan Aasaru and yours truly were joined by Michael Hunger of jexp.de and JEQUEL and together we have created the Squill project that came right out of the ideas in the paper we wrote with Rein Raudjärv. The announcement follows, enjoy!
It is with great pleasure that we announce the first release of Squill. Download it now or check out the quickstart guide, the step-by-step tutorial and the Devoxx presentation.
Squill is a slick internal DSL for writing SQL queries in pure Java. It uses the database metadata and generics to catch as many errors as possible during compilation and is almost completely typesafe.
At the same time it is designed to allow everything SQL allows you to do, exactly the way SQL is meant to do it. This means that you’re encouraged to select only the data you need and no hidden queries are generated for you, leaving you in full control of the query performance. Squill supports database-specific extensions, allowing you to both use advanced features and fully tweak your queries.
Squill also has special support for CRUD operations and table relations, adding some sugar over vanilla SQL. A typical Squill query looks like this:
[java] ComplaintTable c = new ComplaintTable();
for (Tuple2
squill
.from(c, c.customer)
.where(
gt(c.customer.isActive, 0),
notNull(c.percentSolved),
notNull(c.refoundSum))
.orderBy(desc(c.customer.id))
.selectList(
c.customer.lastName,
c.percentSolved)) {
System.out.println(
“Customer ” + tuple2.v1 + ” has a complaint solved ” + tuple2.v2 + “%”);
}
[/java]
Squill is a very young project and you can follow (and help) its development by joining the user or developer mailing lists.