2
Binlerce Öğeyi güncellemem gerekiyor ve mantık SQL deyimine dönüştürülemiyor. yönetilmeyen JPA kullanarak zaman kullanmak kalıptır: Bu konteyner yönetilen işlemleri kullanırken kullanım durumunda bu tür için iyi bir model olduğunu NeopenJPA toplu güncelleştirme modeli
java.lang.IllegalStateException: Transaction management is not available for container managed EntityManagers.
sonuçlanan bir yönetilen ortamda
long commitThreshold = 100; // or other appropriate value
try {
em.beginTransction().begin();
for(list of entities to be modified) {
// retrieve current Entity
// modify current Entity
if((++modifiedEntityCount % commitThreshold) == 0) {
em.getTransaction().commit();
em.getTransaction().begin();
}
}
if(em.getTransaction().isActive()) {
em.getTransaction().commit();
}
catch() {
}
finally {
// cleanup
}
ve blueprint? Benim özel ortamım önemli ise karaf 3.0.5 ve openJPA 2.3.x.