protected final Properties buildProperties() { Properties props = new Properties(); setUnlessNull( props, Environment.DIALECT, dialect ); setUnlessNull( props, Environment.DEFAULT_SCHEMA, defaultSchema ); setUnlessNull( props, Environment.DEFAULT_CATALOG, defaultCatalog ); setUnlessNull( props, Environment.MAX_FETCH_DEPTH, maximumFetchDepth ); setUnlessNull( props, Environment.STATEMENT_FETCH_SIZE, jdbcFetchSize ); setUnlessNull( props, Environment.STATEMENT_BATCH_SIZE, jdbcBatchSize ); setUnlessNull( props, Environment.BATCH_VERSIONED_DATA, batchVersionedDataEnabled ); setUnlessNull( props, Environment.USE_SCROLLABLE_RESULTSET, jdbcScrollableResultSetEnabled ); setUnlessNull( props, Environment.USE_GET_GENERATED_KEYS, getGeneratedKeysEnabled ); setUnlessNull( props, Environment.USE_STREAMS_FOR_BINARY, streamsForBinaryEnabled ); setUnlessNull( props, Environment.USE_REFLECTION_OPTIMIZER, reflectionOptimizationEnabled ); setUnlessNull( props, Environment.QUERY_SUBSTITUTIONS, querySubstitutions ); setUnlessNull( props, Environment.SHOW_SQL, showSqlEnabled ); setUnlessNull( props, Environment.USE_SQL_COMMENTS, commentsEnabled ); setUnlessNull( props, Environment.USE_SECOND_LEVEL_CACHE, secondLevelCacheEnabled ); setUnlessNull( props, Environment.CACHE_PROVIDER, cacheProviderClass ); setUnlessNull( props, Environment.CACHE_REGION_PREFIX, cacheRegionPrefix ); setUnlessNull( props, Environment.USE_MINIMAL_PUTS, minimalPutsEnabled ); setUnlessNull( props, Environment.USE_QUERY_CACHE, queryCacheEnabled ); Map extraProperties = getExtraProperties(); if ( extraProperties != null ) { addAll( props, extraProperties ); } if ( additionalProperties != null ) { addAll( props, additionalProperties ); } return props; }
public final void setJdbcFetchSize(String jdbcFetchSize) { verifyInt( jdbcFetchSize ); this.jdbcFetchSize = jdbcFetchSize; }
public final void addAdditionalProperty(String name, String value) { if ( !getExcludedPropertyNames().contains( name ) ) { if ( additionalProperties == null ) { additionalProperties = new HashMap(); } additionalProperties.put( name, value ); } }
public void setCustomListenersAsString(String customListenersString) { // Note : expected in the syntax: // type=listenerClass // ({sep}type=listenerClass)* // where {sep} is any whitespace or comma if ( StringHelper.isNotEmpty( customListenersString) ) { String[] listenerEntries = PropertiesHelper.toStringArray( customListenersString, " ,\n\t\r\f" ); for ( int i = 0; i < listenerEntries.length; i++ ) { final int keyValueSepPosition = listenerEntries[i].indexOf( '=' ); final String type = listenerEntries[i].substring( 0, keyValueSepPosition ); final String listenerClass = listenerEntries[i].substring( keyValueSepPosition + 1 ); setCustomListener( type, listenerClass ); } } }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = PropertiesHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } if ( customListeners != null && !customListeners.isEmpty() ) { Iterator entries = customListeners.entrySet().iterator(); while ( entries.hasNext() ) { final Map.Entry entry = ( Map.Entry ) entries.next(); final String type = ( String ) entry.getKey(); final Object value = entry.getValue(); if ( value != null ) { if ( String.class.isAssignableFrom( value.getClass() ) ) { // Its the listener class name cfg.setListener( type, ( ( String ) value ) ); } else { // Its the listener instance (or better be) cfg.setListener( type, value ); } } } } return cfg; }
public final void addAdditionalProperty(String name, String value) { if ( !getExcludedPropertyNames().contains( name ) ) { if ( additionalProperties == null ) { additionalProperties = new HashMap(); } additionalProperties.put( name, value ); } }
public void setCustomListenersAsString(String customListenersString) { // Note : expected in the syntax: // type=listenerClass // ({sep}type=listenerClass)* // where {sep} is any whitespace or comma if ( StringHelper.isNotEmpty( customListenersString) ) { String[] listenerEntries = PropertiesHelper.toStringArray( customListenersString, " ,\n\t\r\f" ); for ( int i = 0; i < listenerEntries.length; i++ ) { final int keyValueSepPosition = listenerEntries[i].indexOf( '=' ); final String type = listenerEntries[i].substring( 0, keyValueSepPosition ); final String listenerClass = listenerEntries[i].substring( keyValueSepPosition + 1 ); setCustomListener( type, listenerClass ); } } }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = PropertiesHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } if ( customListeners != null && !customListeners.isEmpty() ) { Iterator entries = customListeners.entrySet().iterator(); while ( entries.hasNext() ) { final Map.Entry entry = ( Map.Entry ) entries.next(); final String type = ( String ) entry.getKey(); final Object value = entry.getValue(); if ( value != null ) { if ( String.class.isAssignableFrom( value.getClass() ) ) { // Its the listener class name cfg.setListener( type, ( ( String ) value ) ); } else { // Its the listener instance (or better be) cfg.setListener( type, value ); } } } } return cfg; }
protected final Properties buildProperties() { Properties props = new Properties(); setUnlessNull( props, Environment.DIALECT, dialect ); setUnlessNull( props, Environment.DEFAULT_SCHEMA, defaultSchema ); setUnlessNull( props, Environment.DEFAULT_CATALOG, defaultCatalog ); setUnlessNull( props, Environment.MAX_FETCH_DEPTH, maximumFetchDepth ); setUnlessNull( props, Environment.STATEMENT_FETCH_SIZE, jdbcFetchSize ); setUnlessNull( props, Environment.STATEMENT_BATCH_SIZE, jdbcBatchSize ); setUnlessNull( props, Environment.BATCH_VERSIONED_DATA, batchVersionedDataEnabled ); setUnlessNull( props, Environment.USE_SCROLLABLE_RESULTSET, jdbcScrollableResultSetEnabled ); setUnlessNull( props, Environment.USE_GET_GENERATED_KEYS, getGeneratedKeysEnabled ); setUnlessNull( props, Environment.USE_STREAMS_FOR_BINARY, streamsForBinaryEnabled ); setUnlessNull( props, Environment.USE_REFLECTION_OPTIMIZER, reflectionOptimizationEnabled ); setUnlessNull( props, Environment.QUERY_SUBSTITUTIONS, querySubstitutions ); setUnlessNull( props, Environment.SHOW_SQL, showSqlEnabled ); setUnlessNull( props, Environment.USE_SQL_COMMENTS, commentsEnabled ); setUnlessNull( props, Environment.USE_SECOND_LEVEL_CACHE, secondLevelCacheEnabled ); setUnlessNull( props, Environment.CACHE_PROVIDER, cacheProviderClass ); setUnlessNull( props, Environment.CACHE_REGION_PREFIX, cacheRegionPrefix ); setUnlessNull( props, Environment.USE_MINIMAL_PUTS, minimalPutsEnabled ); setUnlessNull( props, Environment.USE_QUERY_CACHE, queryCacheEnabled ); Map extraProperties = getExtraProperties(); if ( extraProperties != null ) { addAll( props, extraProperties ); } if ( additionalProperties != null ) { addAll( props, additionalProperties ); } return props; }
public final void setMaximumFetchDepth(String maximumFetchDepth) { verifyInt( maximumFetchDepth ); this.maximumFetchDepth = maximumFetchDepth; }
protected void addAll( Properties target, Map source ) { Iterator itr = source.entrySet().iterator(); while ( itr.hasNext() ) { final Map.Entry entry = ( Map.Entry ) itr.next(); final String propertyName = ( String ) entry.getKey(); final String propertyValue = ( String ) entry.getValue(); if ( propertyName != null && propertyValue != null ) { // Make sure we don't override previous set values if ( !target.keySet().contains( propertyName ) ) { if ( !getExcludedPropertyNames().contains( propertyName) ) { target.put( propertyName, propertyValue ); } } } } }
public final void setMaximumFetchDepth(String maximumFetchDepth) { verifyInt( maximumFetchDepth ); this.maximumFetchDepth = maximumFetchDepth; }
protected void addAll( Properties target, Map source ) { Iterator itr = source.entrySet().iterator(); while ( itr.hasNext() ) { final Map.Entry entry = ( Map.Entry ) itr.next(); final String propertyName = ( String ) entry.getKey(); final String propertyValue = ( String ) entry.getValue(); if ( propertyName != null && propertyValue != null ) { // Make sure we don't override previous set values if ( !target.keySet().contains( propertyName ) ) { if ( !getExcludedPropertyNames().contains( propertyName) ) { target.put( propertyName, propertyValue ); } } } } }
public final void setJdbcBatchSize(String jdbcBatchSize) { verifyInt( jdbcBatchSize ); this.jdbcBatchSize = jdbcBatchSize; }
public final void setJdbcFetchSize(String jdbcFetchSize) { verifyInt( jdbcFetchSize ); this.jdbcFetchSize = jdbcFetchSize; }
public final void setJdbcBatchSize(String jdbcBatchSize) { verifyInt( jdbcBatchSize ); this.jdbcBatchSize = jdbcBatchSize; }