我有一個類,位置。位置包含一個BorderPoint對象列表,但它可以是一個巨大的列表(20,000不是不可能的)。這個表是LOCATION和BORDERPOINT。自動交易在OpenJPA
我最初通過從ESRI Shapefile導入來填充位置。下面是一個代碼剪斷:
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();
}
由於在該列表中,使許多BorderPoint對象,但我只是通過調用持久化Location對象上保存它們,我可以自動設置某種批量大小爲持續的BorderPoints ?
這就是我害怕的答案,但我抱着希望。我在Hibernate自己有點經驗,看起來比JPA更可配置,特別是在Spring下。 – Jason 2011-04-05 00:49:46