com.jdon.model.query.block
Class BlockStrategy

java.lang.Object
  extended by com.jdon.model.query.block.BlockStrategy

public class BlockStrategy
extends java.lang.Object

Block Strategy to increase the performance for a lot of datas fetching from the database ervery time read the database, we fetch a block that maye include 200 datas. note: these datas are the primary keys of the models that save in database.


Constructor Summary
BlockStrategy(BlockQueryJDBC blockQueryJDBC, JdbcTemp jdbcTemp, BlockCacheManager blockCacheManager)
           
 
Method Summary
 Block getBlock(java.lang.String sqlquery, java.util.Collection queryParams, int startIndex, int count)
          get a data block by the sql sentence.
 int getBlockLength()
           
 Block locate(java.lang.String sqlquery, java.util.Collection queryParams, java.lang.Object locateId)
          looking for the primary be equals to locateId in the result for the sql sentence.
 void setBlockLength(int blockLength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockStrategy

public BlockStrategy(BlockQueryJDBC blockQueryJDBC,
                     JdbcTemp jdbcTemp,
                     BlockCacheManager blockCacheManager)
Parameters:
blockQueryJDBC -
jdbcTemp -
blockCacheManager -
Method Detail

locate

public Block locate(java.lang.String sqlquery,
                    java.util.Collection queryParams,
                    java.lang.Object locateId)
looking for the primary be equals to locateId in the result for the sql sentence.

Parameters:
sqlquery -
queryParams -
locateId -
Returns:
if not locate, return null;

getBlock

public Block getBlock(java.lang.String sqlquery,
                      java.util.Collection queryParams,
                      int startIndex,
                      int count)
get a data block by the sql sentence.

Parameters:
sqlqueryAllCount -
sqlquery -
Returns:
if not found, return null;

getBlockLength

public int getBlockLength()
Returns:
Returns the blockLength.

setBlockLength

public void setBlockLength(int blockLength)
Parameters:
blockLength - The blockLength to set.