@@ -299,17 +299,41 @@ public List<HanaDbObject> listGraphWorkspaces() throws SQLException {
299299 */
300300 private void loadWorkspaceMetadata (HanaGraphWorkspace graphWorkspace ) throws SQLException , HanaConnectionManagerException {
301301
302- String propName = "LOAD_WORKSPACE_METADATA_HANA_" +
303- ( isCloudEdition ( this . buildVersion ) ? "CLOUD" :"ONPREM" );
302+ Boolean isCloud = isCloudEdition ( this . buildVersion );
303+ String propName = "LOAD_WORKSPACE_METADATA_HANA_" + ( isCloud ? "CLOUD" :"ONPREM" );
304304
305- debug ("Reading graph metadata with " +propName );
306- HanaQueryResult wsMetadata = this .executeQueryList (
305+ debug ("Reading graph metadata with " + propName );
306+ HanaQueryResult wsMetadata = null ;
307+
308+ try {
309+ wsMetadata = this .executeQueryList (
310+ this .sqlStrings .getProperty (propName ),
311+ new HanaSqlParameter []{
312+ new HanaSqlParameter (graphWorkspace .getWorkspaceDbObject ().schema , Types .VARCHAR ),
313+ new HanaSqlParameter (graphWorkspace .getWorkspaceDbObject ().name , Types .VARCHAR )
314+ }
315+ );
316+ } catch (Exception e ) {
317+ // some rare systems (pre-releases!?) do not return build strings. To act more resilient in those cases,
318+ // we try both workspace structures and only fail if the graph could not be loaded with both available
319+ // approaches.
320+
321+ // Show warning to notify user:
322+ warn ("Could not load graph workspace after assuming " + (isCloud ? "Cloud" : "On-Premise" ) + " Edition of SAP HANA." );
323+ warn ("Re-trying operation with " + (isCloud ? "On-Premise" : "Cloud" ) + " Edition." );
324+
325+ // Swap on-prem to cloud and vice versa:
326+ propName ="LOAD_WORKSPACE_METADATA_HANA_" + (isCloud ? "ONPREM" :"CLOUD" );
327+
328+ // Try again:
329+ wsMetadata = this .executeQueryList (
307330 this .sqlStrings .getProperty (propName ),
308331 new HanaSqlParameter []{
309332 new HanaSqlParameter (graphWorkspace .getWorkspaceDbObject ().schema , Types .VARCHAR ),
310333 new HanaSqlParameter (graphWorkspace .getWorkspaceDbObject ().name , Types .VARCHAR )
311334 }
312335 );
336+ }
313337
314338 for (Object [] row : wsMetadata .getRecordList ()){
315339 // Types will be set when retrieving actual data
0 commit comments