You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Justin Wood <ju...@braidquest.com> on 2003/11/15 17:58:07 UTC
Getting the name(s) of primary columns
I would like to get the names of the primary key columns of a table.
I tried to use the map package clases to figure out the name of the primary
key like so
...
MyTableMapBuilder mapBuilder = new MyTableMapBuilder();
mapBuilder.doBuild();
DatabaseMap map = mapBuilder.getDatabaseMap();
ColumnMap[] colMap = map.getIdTable().getColumns();
String keyColumnName=null;
for (int i=0;i<colMap.length;i++) {
if (colMap[i].isPrimaryKey()) {
keyColumnName=colMap[i].getColumnName();
break;
}
}
System.out.println("key column name: " + keyColumnName);
...
but this returns 'ID_TABLE_ID' and the name of my primary key column is simply
'ID'.
Is there another way?
Justin
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: Getting the name(s) of primary columns
Posted by Dave Newton <da...@solaraccess.com>.
On Sat, 2003-11-15 at 11:58, Justin Wood wrote:
> I would like to get the names of the primary key columns of a table.
> but this returns 'ID_TABLE_ID' and the name of my primary key column is simply
> 'ID'.
>
> Is there another way?
I believe you've asked for the primary key of the id table.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org