Пример #1
0
  /**
   * Returns the names of DbAtributes that comprise the primary key of the parent DbEntity.
   *
   * @since 3.0
   */
  public Collection<String> getPrimaryKeyNames() {
    DbEntity dbEntity = getDbEntity();

    // abstract entities may have no DbEntity mapping
    if (dbEntity == null) {
      return Collections.emptyList();
    }

    Collection<DbAttribute> pkAttributes = dbEntity.getPrimaryKeys();
    Collection<String> names = new ArrayList<String>(pkAttributes.size());

    for (DbAttribute pk : pkAttributes) {
      names.add(pk.getName());
    }

    return Collections.unmodifiableCollection(names);
  }
Пример #2
0
 /**
  * Sets the DbEntity used by this ObjEntity.
  *
  * <p><i>Setting DbEntity on an inherited entity has no effect, since a class of the super entity
  * is always used as a superclass. </i>
  */
 public void setDbEntity(DbEntity dbEntity) {
   this.dbEntityName = (dbEntity != null) ? dbEntity.getName() : null;
 }