Couchdb on the jvm,apis,patterns,use in production or help with a annotation based api

9 views
Skip to first unread message

Darran

unread,
Apr 18, 2010, 2:05:14 PM4/18/10
to couchdb-jvm-integration
Hi,

I guess as the creator of this group I should make the first post :).

I created the group to concentrate on integrating CouchDB with jvm
based languages and to discuss what patterns people are using or what
patterns they would like to see from an api.

Theres a couple of apis out there at the moment and I`d be interested
to know if anyone else is working on an api or have a Grails/Java/
Scala webapp in production using CouchDB. It would also be interesting
to know what apis people are using and how they`ve found them.

I started looking into CouchDB a few weeks ago and I`ve started using
jCouchDB for the project I`m working on. JCouchDB has helped a lot
but ,but coming from a JPA/Hibernate background, I wanted to use an
annotation based approach to keep a clean domain model which doesn`t
have to derive from any base classes.

So I started the jBeanbag project http://code.google.com/p/jbeanbag/ a
couple of weeks ago with the aim of creating a annotation based api
which doesn`t involve deriving any classes in your domain model from a
api class Hierarchy.

I`d like to get other people involved in developing the api or join up
with anyone else whos developing an annotation based api. I think its
quite an interesting project as its a pure Java project which doesn`t
depend on many other jars and it uses a lot of reflection for
serialising to/from JSON/Java.

I`m using the ObjectWeb ASM library for easy parsing of classes ,and
to get generic information which isn`t available using reflection, to
create a meta model of all the fields and annotations in the classes.
This metamodel is cached the first time its created ,using ehcache,
and is used when an associated object is passed in the api to extract/
set fields in the object using reflection.

Why jBeanbag? Well I thought it fits with the whole relax furniture
related themes of couchdb :) and also as far as the api/your
application is concerned its just a bag of java beans no need to tie
it ,via inheritence, to a specific framework as it uses annotations so
your domain model is free to extend what ever it wants.

So please post any messages to discusss how your using CouchDB with a
JVM language,what problems your having or what you`d like to see in an
api. Also if any one wnats to get involved in jBeanbag let me know.

Darran





--
Subscription settings: http://groups.google.com/group/couchdb-jvm-integration/subscribe?hl=en-GB

henrik.lundgren

unread,
Apr 19, 2010, 10:21:31 AM4/19/10
to couchdb-jvm-integration
Hi!

I'm the developer of Ektorp. http://code.google.com/p/ektorp/

It sounds as the goals of jBeanbag coincide a lot with Ektorp's.
The main difference is that Ektorp doesn't have any annotations of its
own, but uses annotations from Jackson

In the next release due any day the requirement to extend classes from
Ektorp has been removed, so you can use any kind of object, as long it
is serializable by Jackson.

Henrik
> Subscription settings:http://groups.google.com/group/couchdb-jvm-integration/subscribe?hl=e...

Darran

unread,
Apr 19, 2010, 5:58:46 PM4/19/10
to couchdb-jvm-integration
Hey Henrik,

The changes to Ektorp sound good. I never like having to derive from a
base class with my domain model.
It does sound like both our apios are similar.
I`ll check it out when the new version is released. Btw if you want
post back how you`d like Ektorp to be described on the api page let me
know.

How are you using CouchDB at the moment?Are you using it in
production?
The project I`m working on is planning on using CouchDB as the main
database, a bit daring I know but the datamodel for the project
isn`t too complicated. The goal with jBeanbag is to try and model
common patterns in couchdb using annotations such as linked documents.
How have you found modeling relationships between documents? Another
area I`ve been thinking about is conflict management. I was thinking
when a conflict is
detected an exception could be thrown containing the different
versions of the document as serialized java Objects.

Darran

On Apr 19, 3:21 pm, "henrik.lundgren" <carl.henrik.lundg...@gmail.com>
wrote:
> Hi!
>
> I'm the developer of Ektorp.http://code.google.com/p/ektorp/
>
> It sounds as the goals of jBeanbag coincide a lot with Ektorp's.
> The main difference is that Ektorp doesn't have any annotations of its
> own, but uses annotations from Jackson
>
> In the next release due any day the requirement to extend classes from
> Ektorp has been removed, so you can use any kind of object, as long it
> is serializable by Jackson.
>
> Henrik
>

henrik.lundgren

unread,
Apr 20, 2010, 3:43:38 AM4/20/10
to couchdb-jvm-integration
I'm using CouchDb and Ektorp as the persistence layer for a CMS like
webbapp.
The application has not been launched yet.

I'm not worried to use CouchDb as the main database, the only problem
that I think will arise is to find an automatic process for migrating/
upgrading documents between releases.

As documents allows for a lot more "embedding" of dependencies
compared to traditional O/R-mapping, maintaining relations becomes
less of an issue.
In most cases you are able to store the whole "aggregate" (to use a
DDD term) in a single document.

In the cases where an inter-document relation is needed I have solved
it by simple id fields in the many-to.one case, and with a view query
in the one-to-many case.
So in those cases you cannot navigate the relationships though the
object graph, but that is not a problem for me.

Regarding conflict management I have chosen to handle by throwing an
exception. I think you can handle conflicts just as you would handle
optimistic concurrency conflicts in hibernate. For idempotent
operations I have developed an spring-based aspect that retries
methods annotated with a @Retryable if an UpdateConflictException
occur. That aspect is currently not in the Ektorp codebase as I want
to keep down the number of dependencies.

Henrik

Darran White

unread,
Apr 21, 2010, 12:53:06 PM4/21/10
to couchdb-jvm...@googlegroups.com
I like the idea of the @Retryable aspect that could be usefull in
other applications. That's also a good way of describing document
bounderies as aggregates. One of the things I plan to do is expose all
the server and database couchdb api requests as a Inc bean which could
be usefull for monitoring management by JConsole

Sent from my iPhone

On 20 Apr 2010, at 08:43, "henrik.lundgren" <carl.henri...@gmail.com
Reply all
Reply to author
Forward
0 new messages