@Test public void testCount() { IQuery<TestGlobalEntity> globalQuery = pinusClient.createQuery(TestGlobalEntity.class); Assert.assertEquals(6, globalQuery.count().longValue()); IQuery<TestEntity> shardingQuery = pinusClient.createQuery(TestEntity.class); Assert.assertEquals(7, shardingQuery.count().longValue()); }
@Override public <T> IQuery<T> createQuery(Class<T> clazz) { ResultSetableQueryImpl<T> query = new ResultSetableQueryImpl<T>(clazz); query.setGlobalQuery(this.globalQuery); query.setShardingQuery(this.shardingQuery); return query; }
DefaultPinusClient implements PinusClient { @Override public <T> IQuery<T> createQuery(Class<T> clazz) { ResultSetableQueryImpl<T> query = new ResultSetableQueryImpl<T>(clazz); query.setGlobalQuery(this.globalQuery); query.setShardingQuery(this.shardingQuery); return query; } }
DefaultPinusClient implements PinusClient { @Override public <T> IQuery<T> createQuery(Class<T> clazz) { ResultSetableQueryImpl<T> query = new ResultSetableQueryImpl<T>(clazz); query.setGlobalQuery(this.globalQuery); query.setShardingQuery(this.shardingQuery); return query; }  }
DefaultPinusClient implements PinusClient { @Override public <T> IQuery<T> createQuery(Class<T> clazz) { ResultSetableQueryImpl<T> query = new ResultSetableQueryImpl<T>(clazz); query.setGlobalQuery(this.globalQuery); query.setShardingQuery(this.shardingQuery); return query; }  void init(); @Override void destroy(); @Override void beginTransaction(); @Override void beginTransaction(EnumTransactionIsolationLevel txLevel); @Override void commit(); @Override void rollback(); @Override void flush(); @Override TaskFuture submit(ITask<T> task, Class<T> clazz); @SuppressWarnings({ "rawtypes", "unchecked" }) @Override TaskFuture submit(ITask<T> task, Class<T> clazz, IQuery<T> query); @Override void save(Object entity); @Override void saveBatch(List<? extends Object> entityList); @Override void saveBatch(List<? extends Object> entityList, boolean autoGeneratedKeys); @Override void update(Object entity); @Override void updateBatch(List<? extends Object> entityList); @Override void delete(Object entity); @Override void delete(List<? extends Object> entityList); @Override void load(Object entity); @Override void load(Object entity, boolean useCache); @Override void load(Object entity, EnumDBMasterSlave masterSlave); @Override void load(Object entity, boolean useCache, EnumDBMasterSlave masterSlave); @Override IQuery<T> createQuery(Class<T> clazz); @Override List<Map<String, Object>> findBySQL(SQL sql, Class<?> clazz); @Override List<Map<String, Object>> findBySQL(SQL sql, String clusterName); @Override IDBCluster getDBCluster(); @Override IPrimaryCache getPrimaryCache(); @Override ISecondCache getSecondCache(); @Override int genClusterUniqueIntId(String name); @Override long genClusterUniqueLongId(String name); @Override long[] genClusterUniqueLongIdBatch(String name, int batchSize); @Override int[] genClusterUniqueIntIdBatch(String name, int batchSize); @Override Lock createLock(String lockName); EnumSyncAction getSyncAction(); @Override void setSyncAction(EnumSyncAction syncAction); String getScanPackage(); @Override void setScanPackage(String scanPackage); }
DefaultPinusClient implements PinusClient { @Override public <T> IQuery<T> createQuery(Class<T> clazz) { ResultSetableQueryImpl<T> query = new ResultSetableQueryImpl<T>(clazz); query.setGlobalQuery(this.globalQuery); query.setShardingQuery(this.shardingQuery); return query; }  void init(); @Override void destroy(); @Override void beginTransaction(); @Override void beginTransaction(EnumTransactionIsolationLevel txLevel); @Override void commit(); @Override void rollback(); @Override void flush(); @Override TaskFuture submit(ITask<T> task, Class<T> clazz); @SuppressWarnings({ "rawtypes", "unchecked" }) @Override TaskFuture submit(ITask<T> task, Class<T> clazz, IQuery<T> query); @Override void save(Object entity); @Override void saveBatch(List<? extends Object> entityList); @Override void saveBatch(List<? extends Object> entityList, boolean autoGeneratedKeys); @Override void update(Object entity); @Override void updateBatch(List<? extends Object> entityList); @Override void delete(Object entity); @Override void delete(List<? extends Object> entityList); @Override void load(Object entity); @Override void load(Object entity, boolean useCache); @Override void load(Object entity, EnumDBMasterSlave masterSlave); @Override void load(Object entity, boolean useCache, EnumDBMasterSlave masterSlave); @Override IQuery<T> createQuery(Class<T> clazz); @Override List<Map<String, Object>> findBySQL(SQL sql, Class<?> clazz); @Override List<Map<String, Object>> findBySQL(SQL sql, String clusterName); @Override IDBCluster getDBCluster(); @Override IPrimaryCache getPrimaryCache(); @Override ISecondCache getSecondCache(); @Override int genClusterUniqueIntId(String name); @Override long genClusterUniqueLongId(String name); @Override long[] genClusterUniqueLongIdBatch(String name, int batchSize); @Override int[] genClusterUniqueIntIdBatch(String name, int batchSize); @Override Lock createLock(String lockName); EnumSyncAction getSyncAction(); @Override void setSyncAction(EnumSyncAction syncAction); String getScanPackage(); @Override void setScanPackage(String scanPackage); static final Logger LOG; static PinusClient instance; }