You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/06/28 01:09:50 UTC

[GitHub] [incubator-shardingsphere] KomachiSion commented on issue #2617: How to config the hint by spring namespace int the sharding-jdbc 3.1 version

KomachiSion commented on issue #2617: How to config the hint by spring namespace int the sharding-jdbc 3.1 version 
URL: https://github.com/apache/incubator-shardingsphere/issues/2617#issuecomment-506563669
 
 
   @xiaotianlongxing, Hint is sharding strategy, it should be injected into `table-strategy-ref` or `database-strategy-ref`
   
   In your example, you injected `sharding:standard-strategy` not `sharding:hint-strategy`, so this function will not be called.
   
   you can change like following and retry
   
   ```
   <bean id="tableShardingAlgorithmByMonth" class="com.xxx.TableShardingAlgorithmByMonth"></bean>
   <bean id="hintTestBean" class="com.xxx.ModuloHintShardingAlgorithm"></bean>
   <sharding:hint-strategy id="hintStrategy"  algorithm-ref="hintTestBean" ></sharding:hint-strategy>
   <sharding:standard-strategy id="payOrderPreciseAlgorithm" sharding-column="create_date" precise-algorithm-ref="tableShardingAlgorithmByMonth"></sharding:standard-strategy>
   <sharding:data-source id="shardingDataSource">
       <sharding:sharding-rule data-source-names="dataSource">
           <sharding:table-rules>
               <sharding:table-rule logic-table="pay_order" table-strategy-ref="hintStrategy"  />
           </sharding:table-rules>
           <sharding:binding-table-rules>
               <sharding:binding-table-rule logic-tables="pay_order"/>
           </sharding:binding-table-rules>
       </sharding:sharding-rule>
       <sharding:props>
           <prop key="sql.show">false</prop>
       </sharding:props>
   </sharding:data-source>
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services