java/dbloader/src/main/java/be/bosa/dt/best/dbloader/PostGisLoader.java
/**
	 * Load municipality part info
	 * 
	 * @param prep prepared statement
	 * @param xmlPath XML BeST directory
	 * @param reg region
	 * @throws SQLException 
	 */
Load municipality part info

@param prep prepared statement
@param xmlPath XML BeST directory
@param reg region
@throws SQLException
Load municipality part info @param prep prepared statement @param xmlPath XML BeST directory @param reg region @throws SQLException
private void loadMunicipalityParts(PreparedStatement prep, Path xmlPath, BestRegion reg) throws SQLException {
		LOG.log(Level.INFO, "Starting municipality parts {0}", reg.getName());
		int cnt = 0;
		MunicipalityPartReader reader = new MunicipalityPartReader();
		Stream<Municipality> parts = reader.read(reg, xmlPath);
		Iterator<Municipality> iter = parts.iterator();
		while (iter.hasNext()) {
			Municipality a = iter.next();
			prep.setString(1, NsConverter.municipalityEncode(a.getIDVersion()));
			prep.setString(2, a.getName("nl"));
			prep.setString(3, a.getName("fr"));
			prep.setString(4, a.getName("de"));
			prep.addBatch();
			if (++cnt % 1000 == 0) {
				prep.executeBatch();
				LOG.log(Level.INFO, "Inserted {0}", cnt);
			}
		}
		prep.executeBatch();
		LOG.log(Level.INFO, "Inserted {0}", cnt);
	}
private void loadMunicipalityParts ( PreparedStatement prep , Path xmlPath , BestRegion reg ) throws SQLException { LOG . log ( Level . INFO , "Starting municipality parts {0}" , reg . getName ( ) ) ; int cnt = 0 ; MunicipalityPartReader reader = new MunicipalityPartReader ( ) ; Stream < Municipality > parts = reader . read ( reg , xmlPath ) ; Iterator < Municipality > iter = parts . iterator ( ) ; while ( iter . hasNext ( ) ) { Municipality a = iter . next ( ) ; prep . setString ( 1 , NsConverter . municipalityEncode ( a . getIDVersion ( ) ) ) ; prep . setString ( 2 , a . getName ( "nl" ) ) ; prep . setString ( 3 , a . getName ( "fr" ) ) ; prep . setString ( 4 , a . getName ( "de" ) ) ; prep . addBatch ( ) ; if ( ++ cnt % 1000 == 0 ) { prep . executeBatch ( ) ; LOG . log ( Level . INFO , "Inserted {0}" , cnt ) ; } } prep . executeBatch ( ) ; LOG . log ( Level . INFO , "Inserted {0}" , cnt ) ; }
Load municipality part info
Load municipality part info
// insert per 1000 records