Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate OpenJPA是否支持批量插入?_Hibernate_Jpa_Openjpa - Fatal编程技术网

Hibernate OpenJPA是否支持批量插入?

Hibernate OpenJPA是否支持批量插入?,hibernate,jpa,openjpa,Hibernate,Jpa,Openjpa,OpenJPA是否支持类似的批量插入?我在文件里没找到,但我希望我没找到。我知道。简短的回答,是的 回答得越长,请获取Hibernate文档的链接,并用JPA EntityManager替换会话 EntityManager em = emf.createEntityManager(); Transaction tx = em.getTransaction(); tx.begin(); for ( int i=0; i<100000; i++ ) { Customer cus

OpenJPA是否支持类似的批量插入?我在文件里没找到,但我希望我没找到。我知道。

简短的回答,是的

回答得越长,请获取Hibernate文档的链接,并用JPA EntityManager替换会话

EntityManager em = emf.createEntityManager();
Transaction tx = em.getTransaction();

tx.begin();   
for ( int i=0; i<100000; i++ ) {
    Customer customer = new Customer(.....);
    em.persist(customer);
    if ( i % 20 == 0 ) { //20, same as the JDBC batch size
        //flush a batch of inserts and release memory:
        em.flush();
        em.clear();
    }
}

tx.commit();
em.close();
EntityManager em=emf.createEntityManager();
事务tx=em.getTransaction();
tx.begin();
对于(inti=0;i简短回答,是的

回答得越长,请获取Hibernate文档的链接,并用JPA EntityManager替换会话

EntityManager em = emf.createEntityManager();
Transaction tx = em.getTransaction();

tx.begin();   
for ( int i=0; i<100000; i++ ) {
    Customer customer = new Customer(.....);
    em.persist(customer);
    if ( i % 20 == 0 ) { //20, same as the JDBC batch size
        //flush a batch of inserts and release memory:
        em.flush();
        em.clear();
    }
}

tx.commit();
em.close();
EntityManager em=emf.createEntityManager();
事务tx=em.getTransaction();
tx.begin();

对于(inti=0;我确信一个简单的谷歌搜索会回答这个问题;“openjpa批量插入”也许。我确信一个简单的谷歌搜索会回答这个问题;“openjpa批量插入”也许。