クラス、場所があります。Location には BorderPoint オブジェクトのリストが含まれていますが、巨大なリストになる可能性があります (20,000 は不可能ではありません)。このためのテーブルは、LOCATION と BORDERPOINT です。
最初に、ESRI Shapefile からのインポートを介して Location を入力します。コードスニップは次のとおりです。
try {
while (featureIterator.hasNext()) {
Location location = new Location();
SimpleFeatureImpl feature = (SimpleFeatureImpl) featureIterator.next();
// set the information in location based on stuff in the feature, lets me clean up this
// method a bit
setLocationInfo(location, feature);
List<BorderPoint> borderPointList = getBorderPoints(feature, location);
//saveBorderPoints(location, feature);
location.setBorderPointList(borderPointList);
try {
locationRepository.persist(location);
} catch (RepositoryException e) {
throw new ServiceException("processShapefile() threw RepositoryException", e);
}
}
} finally {
featureIterator.close();
}
List には非常に多くの BorderPoint オブジェクトがありますが、Location オブジェクトで persist を呼び出してそれらを保存しているだけなので、BorderPoints を永続化するためにある種のバッチ サイズを自動的に設定できますか?