Package com.alvazan.orm.impl.meta.data

Examples of com.alvazan.orm.impl.meta.data.MetaClass


    if(!isInsert && !(entity instanceof NoSqlProxy)) {
      needRead = true;
    }
   
    Class cl = entity.getClass();
    MetaClass metaClass = metaInfo.getMetaClass(cl);
    if(metaClass == null)
      throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" was not scanned and added to meta information on startup.  It is either missing @NoSqlEntity annotation or it was not in list of scanned packages");
   
    putImpl(entity, needRead, metaClass);
  }
View Full Code Here


 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public void put(Object entity) {
    Class cl = entity.getClass();
    MetaClass metaClass = metaInfo.getMetaClass(cl);
    if(metaClass == null)
      throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" was not scanned and added to meta information on startup.  It is either missing @NoSqlEntity annotation or it was not in list of scanned packages");

    boolean needRead = false;
    MetaIdField idField = metaClass.getIdField();
    Object id = metaClass.fetchId(entity);
    if(idField.isAutoGen() && id != null && !(entity instanceof NoSqlProxy)) {
      //We do NOT have the data from the database IF this is NOT a NoSqlProxy and we need it since this is an
      //update
      needRead = true;
    }
View Full Code Here

  }
 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public void fillInWithKey(Object entity) {
    MetaClass metaClass = metaInfo.getMetaClass(entity.getClass());
    MetaIdField idField = metaClass.getIdField();
    idField.fillInAndFetchId(entity);
  }
View Full Code Here

  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Override
  public void remove(Object entity) {
    MetaClass metaClass = metaInfo.getMetaClass(entity.getClass());
    if(metaClass == null)
      throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" was not scanned and added to meta information on startup.  It is either missing @NoSqlEntity annotation or it was not in list of scanned packages");

    Object proxy = entity;
    Object pk = metaClass.fetchId(entity);
    MetaIdField idField = metaClass.getIdField();
    byte[] rowKey = idField.convertIdToNonVirtKey(pk);
    byte[] virtKey = idField.formVirtRowKey(rowKey);
    DboTableMeta metaDbo = metaClass.getMetaDbo();
   
    if(!metaClass.hasIndexedField()) {
      session.remove(metaDbo, virtKey);
      return;
    } else if(!(entity instanceof NoSqlProxy)) {
      //then we don't have the database information for indexes so we need to read from the database
      proxy = find(metaClass.getMetaClass(), pk);
    }
   
    List<IndexData> indexToRemove = metaClass.findIndexRemoves((NoSqlProxy)proxy, rowKey);
   
    //REMOVE EVERYTHING HERE, we are probably removing extra and could optimize this later
    for(IndexData ind : indexToRemove) {
      session.removeFromIndex(metaDbo, ind.getColumnFamilyName(), ind.getRowKeyBytes(), ind.getIndexColumn());
    }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.impl.meta.data.MetaClass

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.