Horizontal and vertical segmentation in DatabasesHttp://blog.csdn.net/haydenwang8287/archive/2010/02/24/5321600.aspx
Hibernate shardsA 20% project originated from a small engineer team at Google. It provides a horizontal database split solution.
hibernate shards extends hibernate core to reduce complexity. It can be divided into two parts in concept.
1. basic logic
• Org. hibernate. session
• Org. hibernate. sessionfactory
• Org. hibernate. criteria
• Org. hibernate. query
is extended.
• Org. hibernate. shards. session. shardedsession
• Org. hibernate. shards. shardedsessionfactory
• Org. hibernate. shards. criteria. shardedcriteria
• Org. hibernate. shards. query. shardedquery
you can easily use it, just like a common hibernate application.
2. Application logic
provides three interfaces for processing specific implementation policies.
• Org. hibernate. shards. strategy. selection. shardselectionstrategy
• Org. hibernate. shards. strategy. resolution. shardresolutionstrategy
• Org. hibernate. shards. strategy. access. shardaccessstrategy
Shardaccessstrategy:
Data retrieval policies include:
Sequentialshardaccessstrategy: sequence policy
Parallelshardaccessstrategy: concurrency Policy
If you want to retrieve only one database Sessionfactory. Currently, the policy does not support retrieving one or more databases.
All databases are involved.
Shardselectionstrategy:
When a new data is saved, it is decided to store it in that database.
Shardresolutionstrategy:
After the data is modified, determine the database to which the data is synchronized.
Official documentation
Http://docs.jboss.org/hibernate/stable/shards/reference/en/html/index.html