Depeche


SourceForge project * Download * Javadoc * Wiki * Source repository * Forum * IRC

Latest release: 0.7.1 (11 Sep 2013)

What is Depeche?

Depeche is a Java database mapper. What do I mean by that? It enables you to work with databases using data structures. Queries are Lists of records, and records are Maps of field names to field values.
It strives to be very simple and easy to use and to prevent mistakes. It avoids the tediousness of using JDBC directly as well as the heaviness of a full-blown ORM.

Here are some of the features:

Requirements

Currently, Depeche requires Java 6 (or newer) and SLF4J.

Is this an ORM?

Depeche is not an ORM because it doesn't go all the way to objects (beans). However it could be used as part of an ORM (and there is one under construction).

Also, the way it works can make certain tasks easier, such as displaying the result of a query or generating a form. With an ORM, you would normally go from the database through some kind of data structures, to objects, and then use reflection to iterate over objects and their properties as if working with data structures. With Depeche, the "objects" part is eliminated and you can work directly with the data structures.

Why yet another database library for Java?

Because I haven't found one that I really like. Besides, I thought it would be fun to implement my own library.

Why call it "Depeche"?

Several reasons: "dépêche" means "hurry" in French, and this library can hopefully help develop applications quickly; Depeche is partly inspired from Django, so I thought it would be nice to keep the musical theme, and Depeche Mode is one of my favorite bands.

Enough with the talk, let's see some code!

Provider p = new PGProvider("localhost", "sample", "user", "pass");
for (Record rec : p.query("person").filter("first_name", "John").order("last_name")) {
	System.out.println(rec);
}
Possible result:
{id=4, first_name=John, last_name=Brown, sex=M}
{id=2, first_name=John, last_name=Smith, sex=M}

Interested?

Please download and try it out, check out the wiki for more information, and ask questions in the forum or on IRC.


Thanks SourceForge for hosting the project.