public boolean isGeneratedKeysSupported()

in rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java [66:95]


    public boolean isGeneratedKeysSupported() {
        try{
            if(this.generatedKeysSupported == null){
                DatabaseMetaData dbmsMetadata = this.connection.getMetaData();
                boolean supportsGetGeneratedKeys = dbmsMetadata.supportsGetGeneratedKeys();
                if(supportsGetGeneratedKeys){
                    this.generatedKeysSupported = "true";
                }
                //currently DERBY partially supports this feature and thus returns FALSE,
                //this hardcoding is needed as the partial support is enough for DAS
                //we can remove this later, when DERBY change the behaviour of it's "supportsGetGeneratedKeys"
                else if(dbmsMetadata.getDatabaseProductName().indexOf("Derby") > 0){                    
                    this.generatedKeysSupported = "true";
                }
                else{
                    this.generatedKeysSupported = "false";
                }
            }           
        }catch(Exception e){//can be from supportsGetGeneratedKeys or due to absense of supportsGetGeneratedKeys
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("exception setiing useGetGeneratedKeys false");
            }
            this.generatedKeysSupported = "false";
        }
        
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("returning useGetGeneratedKeys():"+ this.generatedKeysSupported);
        }
        return Boolean.valueOf(this.generatedKeysSupported).booleanValue();
    }