incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wettin <>
Subject [ANN] New java bindings
Date Sun, 05 Jul 2009 23:46:50 GMT
Hi forum,

I've implemented a new Java bindings library with a consumer API  
similar to BDB JE, but without some of the limitations in the latter.

Except for beeing faster than any of the binding I've tried it also  
features normalization of aggregated entities, and "abortable  
sessions" with a limited set of features similar to those one can find  
in transactions: begin, commit and rollbacks but with conflict caveats.

The tarball contains a large and complex demo application with lots of  
data in XML-format, thus the file size.

Here is smaller example also available on the webpage:

public class Service {

   private EntityStore store;

   private PrimaryIndex<Long, Artist> artists;
   private PrimaryIndex<Long, Album> albums;
   private PrimaryIndex<Long, Track> tracks;

   public Service() {
     store = new EntityStore();"localhost", 5984);

     artists = store.getPrimaryIndex(Long.class, Artist.class);
     albums = store.getPrimaryIndex(Long.class, Album.class);
     tracks = store.getPrimaryIndex(Long.class, Track.class);

   public static void main(String[] args) throws Exception {
     Service service = new Service();

     Artist artist = new Artist();
     // create a graph

     Artist artist2 = service.get(artist.getId());
     assertFalse(artist == artist2);
     assertEquals(artist, artist2);


public class Artist {

   private Long id;

   private String name;

   @Normalized(paths={"name", "tracks.title"})
   private List<Album> albums;

   // getters and setters...

public class Album {

   private Long id;

   private String name;

   @Normalized(paths={"name", ""})
   private List<Track> tracks;

   private Artist mainArtist;

   // getters and setters...

public class Track {

   private Long id;

   private String title;

   private Artist artist;

   private int length;

   private int discNumber;

   // getters and setters...



View raw message