refactored jpa and couchdb into own libraries