* Optimize getDbColumns() for inheriting relational dbmappings.
* Avoid useless double assignment to column field
This commit is contained in:
parent
3a263d9243
commit
514ad900c5
1 changed files with 4 additions and 4 deletions
|
@ -926,8 +926,9 @@ public final class DbMapping {
|
||||||
public synchronized DbColumn[] getColumns()
|
public synchronized DbColumn[] getColumns()
|
||||||
throws ClassNotFoundException, SQLException {
|
throws ClassNotFoundException, SQLException {
|
||||||
if (!isRelational()) {
|
if (!isRelational()) {
|
||||||
throw new SQLException("Can't get columns for non-relational data mapping " +
|
throw new SQLException("Can't get columns for non-relational data mapping " + this);
|
||||||
this);
|
} else if (inheritsStorage()) {
|
||||||
|
return parentMapping.getColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use local variable cols to avoid synchronization (schema may be nulled elsewhere)
|
// Use local variable cols to avoid synchronization (schema may be nulled elsewhere)
|
||||||
|
@ -963,8 +964,7 @@ public final class DbMapping {
|
||||||
DbColumn col = new DbColumn(colName, meta.getColumnType(i + 1), rel, this);
|
DbColumn col = new DbColumn(colName, meta.getColumnType(i + 1), rel, this);
|
||||||
list.add(col);
|
list.add(col);
|
||||||
}
|
}
|
||||||
columns = new DbColumn[list.size()];
|
columns = (DbColumn[]) list.toArray(new DbColumn[list.size()]);
|
||||||
columns = (DbColumn[]) list.toArray(columns);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return columns;
|
return columns;
|
||||||
|
|
Loading…
Add table
Reference in a new issue