Syntax errors in documentation code for Obtaining a ShardedSessionFactory
-------------------------------------------------------------------------
Key: HSHARDS-5
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-5
Project: Hibernate Shards
Issue Type: Bug
Components: documentation
Affects Versions: 3.0.0.Beta1
Reporter: Nathan Silberman
Assignee: Max Ross
Priority: Trivial
The 3rd code block in section 2.2. Obtaining a ShardedSessionFactory contains several
trivial syntax errors. The following block contains the corrected code with commonts
pointing out the corrections.
1 public SessionFactory createSessionFactory() {
2 Configuration prototypeConfig = new
Configuration().configure("shard0.hibernate.cfg.xml");
3 prototypeConfig.addResource("weather.hbm.xml");
4 List<Configuration> shardConfigs = new ArrayList<Configuration>();
5 shardConfigs.add(new
Configuration().configure("shard0.hibernate.cfg.xml") ); // added parenthasis
6 shardConfigs.add(new
Configuration().configure("shard1.hibernate.cfg.xml") ); // added parenthasis
7 shardConfigs.add(new
Configuration().configure("shard2.hibernate.cfg.xml") ); // added parenthasis
8 ShardStrategyFactory shardStrategyFactory = buildShardStrategyFactory();
9 ShardedConfiguration shardedConfig = new ShardedConfiguration(
10 prototypeConfig,
11 shardConfigs,
12 shardStrategyFactory);
13 return shardedConfig.buildShardedSessionFactory();
14 }
15
16 ShardStrategyFactory buildShardStrategyFactory() {
17 ShardStrategyFactory shardStrategyFactory = new ShardStrategyFactory() { //
classname changed FROM StrategyFactory
18 public ShardStrategy newShardStrategy(List shardIds) {
19 RoundRobinShardLoadBalancer loadBalancer = new
RoundRobinShardLoadBalancer(shardIds);
20 ShardSelectionStrategy pss = new
RoundRobinShardSelectionStrategy(loadBalancer);
21 ShardResolutionStrategy prs = new
AllShardsShardResolutionStrategy(shardIds);
22 ShardAccessStrategy pas = new SequentialShardAccessStrategy();
23 return new ShardStrategyImpl(pss, prs, pas);
24 }
25 }; // added semi-colon here
26 return shardStrategyFactory;
27 }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira