A
A
arturgspb2014-03-30 23:01:48
Java
arturgspb, 2014-03-30 23:01:48

Spring + JPA how to set up data sharding?

Hello!
I did some cursory research on this issue and somehow didn't find any satisfactory results, so I thought I'd ask.
And so, what I have:
* Spring 3.2.1.RELEASE
* Hibernate 4.3.4.Final
* JPA repositories connected via: <jpa:repositories base-package="xxx />
* Configured JpaTransactionManager and *.jpa.LocalContainerEntityManagerFactoryBean.
* Repositories without implementations, inherited from JpaRepository + @Query (seems to be a good thing, but I have not decided yet) I
plan to deal with the topic of data sharding, while, if possible, I would like to write less code to set this up.
I looked at Hibernate Shards, but it seems to be abandoned, and in general it seems like it extends the standard JPA.
In general, the essence of the question is this - how do you do data sharding using jpa repositories, well, or without them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
arturgspb, 2017-08-14
@arturgspb

So, from the height of the past years =)
If you need sharding, then most likely you will not be satisfied with JPA in terms of functionality and limitations, and you just need to use JdbcTemplate and make some kind of ShardService thread that will give you a pull to connect to the desired shard using the ShardService.getConnect ( String shardKey) and this is likely to be the easiest.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question