Issue Type: Bug Bug
Affects Versions: 8.0-RC2
Assignee: Unassigned
Components: jdbc
Created: 04/Jul/12 4:42 AM
Description:

To recognize autoincrement on primary columns in oracle (sequence + insert trigger) I use the pk metatable capabilities of geotools. Because of naming conventions this table needs to be renamed so I specified the custom name (without schema name) via property as followed:

Find datastore with custom pk metatable
Map<String, Object> params = new HashMap<String, Object>();
params.put(JDBCDataStoreFactory.DBTYPE.key, "oracle");
params.put(JDBCJNDIDataStoreFactory.JNDI_REFNAME.key, DATASOURCE_JNDI_NAME);
params.put(JDBCDataStoreFactory.PK_METADATA_TABLE.key, "CUSTOM_TABLE_NAME"); //table name without schema
JDBCDataStore datastore = (JDBCDataStore)DataStoreFinder.getDataStore(params);

The resultant statement looks like this: SELECT * FROM CUSTOM_TABLE_NAME.GT_PK_METADATA

The reason is located in JDBCDataStoreFactory:

org.geotools.jdbc.JDBCDataStoreFactory.java:199
String metadataTable = (String) PK_METADATA_TABLE.lookUp(params);
if(metadataTable != null)  {
	MetadataTablePrimaryKeyFinder tableFinder = new MetadataTablePrimaryKeyFinder();
	if(metadataTable.contains(".")) {
		//...
	} else {
		tableFinder.setTableSchema(metadataTable); // THIS IS WRONG
		// should be: tableFinder.setTableName(metadataTable);
	}
	//...
}

Instead of setting the table name the schema name gets modified.

I hope somebody can fix it quickly because setting the schema prior as configuration is not applicable for me (jndi connection configuration allows change of database without touching source code).

Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: c:\Program Files\apache-maven-3.0.4\bin\..
Java version: 1.6.0_29, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_29\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Project: GeoTools
Priority: Critical Critical
Reporter: Robin Pradel
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to