13

I am working on a Java application that requires horizontal partitioning of data in different PostgreSQL servers. I would like to use a JPA framework and Spring for transaction management.

The most popular frameworks for sharding data with JPA seem to be Hibernate Shards, which appears to be no longer in development, and OpenJPA Slice, which does not support virtual shards (one of my requirements). Are there any other options that I'm missing, or a way to get around the OpenJPA limitation?

Thanks in advance for your input!

Arjan Tijms
  • 36,666
  • 12
  • 105
  • 134
is-serp
  • 171
  • 1
  • 9
  • Can detail "virtual shards", please? – Aubin Dec 02 '12 at 18:03
  • Hi Aubin. Basically a virtual (or logical) shard is a shard that does not reside in a separate server, but on the same server with some kind of boundary, say in a separate schema. – is-serp Dec 02 '12 at 18:19
  • Wouldn't Hibernate's multi-tenancy with partitioning support your use case? – dinukadev Dec 03 '12 at 10:51
  • @dinukadev - I just came across Hibernate multi-tenancy and I am investigating it. Another possible solution is to use OpenJPA Slice and have a different user per schema with different default search path. – is-serp Dec 03 '12 at 13:17
  • How do you know it does not support virtual shards ? It looks like each slice is defined by a jdbc connection property that could point to the same machine. – Assaf Karmon Dec 11 '12 at 21:56
  • Same machine yes, same database no since there is no way in the PostgreSQL JDBC connection string to supply the schema. That being said, [someone did a patch for it](http://stackoverflow.com/a/5491562/1870723). – is-serp Dec 12 '12 at 08:12

2 Answers2

3

You can have a look at Sharding-JDBC, it is a JDBC driver for shard databases and tables, can adapter for any ORM frameworks.

terrymanu
  • 31
  • 2
1

Have you looked into EclipseLink? It supports JPA2 and horizontal sharding.

The documentation says it supports Sharding over multiple database instance

Mark Robinson
  • 3,023
  • 1
  • 22
  • 36