Search code examples
sql-servermongodbcassandrahbasegora

Would Apache Gora fit when you have to build an application which writes/reads from a set of databases?


Would Apache Gora fit when you have to build an application which writes/reads from a set of databases including SQLServer, MongoDB, HBase & Cassandra?

The idea is to develop an application which is capable of performing CRUD operations across databases? Request 1 goes to SQLServer, Request 2 goes to MongoDB and Request 3 goes to HBase and so on. The Request will have the information as to which database the application should hit and there is a finite list of databases.

Are there any alternatives?

Any pointers?

Let me know if any other information is required.


Solution

  • From your description I would say "yes", except accessing SQL Server (not supported).

    Two things I can tell you as BIG tips to begin:

    1. Create your datastores with this DataStoreFactory#createDataStore() method that allows to configure a different "gora.properties" content, and Configuration.
    2. Remember that each gora-xxx-mapping.xml is shared between all the connections to a same backend.

    Alternatives:

    -- Edit from comments:

    There is a gora-sql module but it had to be disabled years ago because of some license issues. If you look at the modules in the pom, you will see that gora-sql is not being compiled. No one took the staff to rebuild it :(

    About point 2, it can exist Application1MongoDB and Application2MongoDB: If they are different applications, they can have a different gora-xxx-mapping.xml in each one's classpath. If they are datastores instances from calls to #createDataStore() (in the same application), then all the mappings will have to go in the casspath's gora-xxx-mapping.xml. It is just a tip I advised that I found tricky.

    More alternatives:

    • Hibertane OGM as told in the comments.
    • EclipseLink (although does not support much backends)
    • DataNucleus