I'm trying to upgrande a 8-years legacy application that worked with some HA-JDBC 2.0.x classes for database meta-data extraction. Unfortunately, such version is no longer available in the official Maven repository, and the new API have changed a lot!... I haven't found any documentation so I don't have any clue how to update the following code, intented to identify if a given column name, in a given table, is a unique key:
DatabaseMetaDataSupport metaSup = new DatabaseMetaDataSupport(dbMetaData,new OracleDialect());<- Not defined
Iterator<UniqueConstraint> uniqueConstraints =
metaSup.getUniqueConstraints(dbMetaData,new QualifiedName(dbMetaData.getUserName(),table), null).iterator();<- Not defined
while(uniqueConstraints.hasNext()&&!response){
UniqueConstraint uc = uniqueConstraints.next();
List<String> columns = uc.getColumnList();for(int i=0;i<columns.size()&&!response;i++)if(columns.get(i).equals(name))
response = true;}return response;} catch (SQLException e){
throw new OracleRetrieverException(SQL_ERROR,e);}}
DatabaseMetaDataSupport and QualifiedName are now interfaces, so I have been checking the latest API, but there is no documentation on how to use the new provided classes: DatabaseMetaDataSupportFactory, UniqueConstraint, etc.
Any clarification on how to use the new API for this scenario would be really appreciated!
Héctor
Last edit: Héctor Cadavid 2017-07-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to upgrande a 8-years legacy application that worked with some
HA-JDBC 2.0.x classes for meta-data extraction. Unfortunately, such version
is no longer available in the official Mavenrepositories, and the API have
changed considerably!... I haven't found any documentation so I don't have
any clue how to update the following code, intented to identify if a given
column name, in a given table, is a unique key:
DatabaseMetaDataSupport metaSup = new DatabaseMetaDataSupport(dbMetaData,new OracleDialect()); <- Not defined
Iterator<UniqueConstraint> uniqueConstraints =
metaSup.getUniqueConstraints(dbMetaData,new QualifiedName(dbMetaData.getUserName(),table), null).iterator(); <- Not defined
DatabaseMetaDataSupport and QualifiedName are now interfaces, so I have
been checking the latest API, but there is no documentation on how to use
the new provided classes: DatabaseMetaDataSupportFactory, UniqueConstraint,
etc.
Any clarification on how to use the new API for this scenario would be
really appreciated!
Dear friends,
I'm trying to upgrande a 8-years legacy application that worked with some HA-JDBC 2.0.x classes for database meta-data extraction. Unfortunately, such version is no longer available in the official Maven repository, and the new API have changed a lot!... I haven't found any documentation so I don't have any clue how to update the following code, intented to identify if a given column name, in a given table, is a unique key:
DatabaseMetaDataSupport and QualifiedName are now interfaces, so I have been checking the latest API, but there is no documentation on how to use the new provided classes: DatabaseMetaDataSupportFactory, UniqueConstraint, etc.
Any clarification on how to use the new API for this scenario would be really appreciated!
Héctor
Last edit: Héctor Cadavid 2017-07-31
This is the equivalent code in HA-JDBC 3.0:
Dialect dialect = new OracleDialect();
DatabaseProperties database = new LazyDatabaseProperties(new
SimpleDatabaseMetaDataProvider(metaData), dialect);
TableProperties table = databaseProperties.findTable(tableName);
Collection<UniqueConstraint> constraints = table.getUniqueConstraints();
Paul
On Mon, Jul 31, 2017 at 7:14 PM "Héctor Cadavid" hectorcadavid@users.sf.net
wrote:
Thank you so much for your reponse Paul!, I will give it a try!