Example #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);
  }