Package com.alvazan.orm.api.z5api

Examples of com.alvazan.orm.api.z5api.NoSqlSession


    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here


   
    mgr.flush();
   
    //Here we have to go raw and update the index ourselves with another fake PartAccount that does
    //not exist
    NoSqlSession session = mgr.getSession();
    DboTableMeta table = mgr.find(DboTableMeta.class, "PartAccount");
    DboColumnMeta colMeta = table.getColumnMeta("businessName");
    ScanInfo info = ScanInfo.createScanInfo(colMeta, null, null);
    IndexColumn col = new IndexColumn();
    col.setColumnName("businessName");
    String key = "nonexistpk";
    byte[] pk = StandardConverters.convertToBytes(key);
    byte[] value = StandardConverters.convertToBytes(acc.getBusinessName());
    col.setIndexedValue(value);
    col.setPrimaryKey(pk);
    session.persistIndex(table, info.getIndexColFamily(), info.getRowKey(), col);
   
    mgr.flush();
   
    Iterable<KeyValue<PartAccount>> all = PartAccount.findWithBizName(mgr, acc.getBusinessName());
    List keys = new ArrayList();
View Full Code Here

  @Test
  public void testDecimalColumnSlice() throws UnsupportedEncodingException {
    if (FactorySingleton.getServerType() == DbTypeEnum.HBASE )
                return; // This testcase is not supported for Hbase
        NoSqlSession session = mgr.getSession();
    String colFamily = "float_indexes";
   
    DboDatabaseMeta meta = mgr.find(DboDatabaseMeta.class, DboDatabaseMeta.META_DB_ROWKEY);

    DboTableMeta tableMeta = new DboTableMeta();
    tableMeta.setup(null, colFamily, false, false);
    tableMeta.setColNameType(double.class);
   
    DboColumnIdMeta idMeta = new DboColumnIdMeta();
    idMeta.setup(tableMeta, "id", String.class, false);
   
    mgr.put(idMeta);
    mgr.put(tableMeta);

    meta.addMetaClassDbo(tableMeta);
    mgr.put(meta);
   
    mgr.flush();
   
    byte[] rowKey = StandardConverters.convertToBytes("myone_index");
   
    List<Column> columns = new ArrayList<Column>();
   
    columns.add(new Column(toDecBytes(5000.5), new byte[0]));
    columns.add(new Column(toDecBytes(20.333), new byte[0]));
    columns.add(new Column(toDecBytes(200.1111111111111), new byte[0]));
    columns.add(new Column(toDecBytes(10.9999999999999999999999999), new byte[0]));
    columns.add(new Column(toDecBytes(60.5), new byte[0]));
    columns.add(new Column(toDecBytes(700), new byte[0]));
    columns.add(new Column(toDecBytes(500023432430.44), new byte[0]));
    columns.add(new Column(toDecBytes(550.32), new byte[0]));
    columns.add(new Column(toDecBytes(340), new byte[0]));
    columns.add(new Column(toDecBytes(40.5), new byte[0]));
    columns.add(new Column(toDecBytes(-40.8888888888888888), new byte[0]));
    columns.add(new Column(toDecBytes(-200.23), new byte[0]));
    columns.add(new Column(toDecBytes(-500), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("123000111222333444555666.66666666")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("-123000111222333444555666.888888")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("3")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("-3")), new byte[0]));
   
    session.put(tableMeta, rowKey, columns);
    session.flush();

    byte[] from = toDecBytes(-250);
    byte[] to = toDecBytes(12);
    Cursor<Column> results = session.columnSlice(tableMeta, rowKey, from, to, 2, BigDecimal.class);//(scanInfo, from, to, 2);
   
    int counter = 0;
    while(results.next()) {
      Column col = results.getCurrent();
      if(counter == 0) {
View Full Code Here

    Assert.assertEquals(5, counter);   
  }

  @Test
  public void testIntegerColumnSlice() throws UnsupportedEncodingException {
    NoSqlSession session = mgr.getSession();
    String colFamily = "time_indexes";
   
    DboDatabaseMeta meta = mgr.find(DboDatabaseMeta.class, DboDatabaseMeta.META_DB_ROWKEY);

    DboTableMeta tableMeta = new DboTableMeta();
    tableMeta.setup(null, colFamily, false, false);
    tableMeta.setColNameType(long.class);
   
    DboColumnIdMeta idMeta = new DboColumnIdMeta();
    idMeta.setup(tableMeta, "id", String.class, false);
   
    mgr.put(idMeta);
    mgr.put(tableMeta);

    meta.addMetaClassDbo(tableMeta);
    mgr.put(meta);
   
    mgr.flush();
   
    byte[] rowKey = StandardConverters.convertToBytes("myone_index");
   
    List<Column> columns = new ArrayList<Column>();
   
    columns.add(new Column(toIntBytes(500), new byte[0]));
    columns.add(new Column(toIntBytes(20), new byte[0]));
    columns.add(new Column(toIntBytes(200), new byte[0]));
    columns.add(new Column(toIntBytes(10), new byte[0]));
    columns.add(new Column(toIntBytes(60), new byte[0]));
    columns.add(new Column(toIntBytes(700), new byte[0]));
    columns.add(new Column(toIntBytes(500023432430L), new byte[0]));
    columns.add(new Column(toIntBytes(550), new byte[0]));
    columns.add(new Column(toIntBytes(340), new byte[0]));
    columns.add(new Column(toIntBytes(40), new byte[0]));
    columns.add(new Column(toIntBytes(-40), new byte[0]));
    columns.add(new Column(toIntBytes(-200), new byte[0]));
    columns.add(new Column(toIntBytes(-500), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("123000111222333444555666")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("-123000111222333444555666")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("3")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("-3")), new byte[0]));
   
    session.put(tableMeta, rowKey, columns);
    session.flush();

    byte[] from = toIntBytes(-250);
    byte[] to = toIntBytes(50);
    Cursor<Column> results = session.columnSlice(tableMeta, rowKey, from, to, 2, BigInteger.class);
   
    int counter = 0;
    while(results.next()) {
      Column col = results.getCurrent();
      if(counter == 0)
View Full Code Here

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z5api.NoSqlSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.