Package jodd.db.oom

Examples of jodd.db.oom.DbEntityDescriptor


  /**
   * Finds entity descriptor of a table that contains provided column reference.
   */
  public DbEntityDescriptor findTableDescriptorByColumnRef(String columnRef) {
    for (Map.Entry<String, TableRefData> entry : tableRefs.entrySet()) {
      DbEntityDescriptor ded = entry.getValue().desc;

      if (ded.findByPropertyName(columnRef) != null) {
        return ded;
      }
    }
    return null;
  }
View Full Code Here


  /**
   * Lookups for entity name and throws exception if entity name not found.
   */
  protected DbEntityDescriptor lookupName(String entityName) {
    DbEntityDescriptor ded = dbOomManager.lookupName(entityName);
    if (ded == null) {
      throw new DbSqlBuilderException("Entity name not registered: " + entityName);
    }
    return ded;
  }
View Full Code Here

  /**
   * Lookups for entity name and throws an exception if entity type is invalid.
   */
  protected DbEntityDescriptor lookupType(Class entity) {
    DbEntityDescriptor ded = dbOomManager.lookupType(entity);
    if (ded == null) {
      throw new DbSqlBuilderException("Invalid or not-persistent entity type: " + entity.getName());
    }
    return ded;
  }
View Full Code Here

  /**
   * Lookups for table reference and throws an exception if table reference not found.
   */
  protected DbEntityDescriptor lookupTableRef(String tableRef) {
    DbEntityDescriptor ded = getTableDescriptor(tableRef);
    if (ded == null) {
      throw new DbSqlBuilderException("Table reference not used in this query: " + tableRef);
    }
    return ded;
  }
View Full Code Here

   * Otherwise, entity will be inserted into the database.
   */
  public <E> E store(E entity) {
    DbOomManager dboom = DbOomManager.getInstance();
    Class type = entity.getClass();
    DbEntityDescriptor ded = dboom.lookupType(type);

    if (ded == null) {
      throw new DbOomException("Not an entity: " + type);
    }
    if (isPersistent(ded, entity) == false) {
View Full Code Here

      if (result != 0) {
        // now reset the ID value
        DbOomManager dboom = DbOomManager.getInstance();
        Class type = entity.getClass();
        DbEntityDescriptor ded = dboom.lookupType(type);

        setEntityId(ded, entity, 0);
      }
    }
  }
View Full Code Here

      if ((tableName.equals(lastTableName) == false) || (resultColumns.contains(columnName) == true)) {
        resultColumns.clear();
        lastTableName = tableName;

        DbEntityDescriptor ded = dbOomManager.lookupTableName(tableName);
        if (ded == null) {
          throw new DbOomException(dbOomQuery, "Table name not registered: " + tableName);
        }

        classes.add(ded.getType());
      }
      resultColumns.add(columnName);
    }
    return classes.toArray(new Class[classes.size()]);
  }
View Full Code Here

    if (cachedMappedNames == null) {
      String[][] names = new String[types.length][];
      for (int i = 0; i < types.length; i++) {
        Class type = types[i];
        if (type != null) {
          DbEntityDescriptor ded = cachedDbEntityDescriptors[i];
          if (ded != null) {
            Class[] mappedTypes = ded.getMappedTypes();
            if (mappedTypes != null) {
              names[i] = createTypesTableNames(mappedTypes);
            }
          }
        }
View Full Code Here

    for (int i = 0; i < types.length; i++) {
      if (types[i] == null) {
        names[i] = null;
        continue;
      }
      DbEntityDescriptor ded = dbOomManager.lookupType(types[i]);
      if (ded != null) {
        String tableName = ded.getTableName();
        tableName = tableName.toUpperCase();
        names[i] = tableName;
      }
    }
    return names;
View Full Code Here

      }

      if (tableMatched) {
        if (resultColumns.contains(columnName) == false) {
          //DbEntityDescriptor ded = dbOomManager.lookupType(currentType);
          DbEntityDescriptor ded = dbEntityDescriptors[currentResult];

          DbEntityColumnDescriptor dec = ded.findByColumnName(columnName);
          String propertyName = (dec == null ? null : dec.getPropertyName());

          // check if a property that matches column name exist
          if (propertyName != null) {
View Full Code Here

TOP

Related Classes of jodd.db.oom.DbEntityDescriptor

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.