简体   繁体   English

Spring Batch中的Hibernate会话(EntityManager)作用域?

[英]The Hibernate session (EntityManager) scope in Spring Batch?

As I'm new to Spring and Spring Batch, I have a general question about Spring Batch and JPA using Hibernate as provider. 由于我是Spring和Spring Batch的新手,所以我对使用Hibernate作为提供程序的Spring Batch和JPA有一个一般性的问题。

Please, I want to know when the Hibernate session (wrapped by the EntityManager) is flushed ? 拜托,我想知道什么时候 刷新 Hibernate会话(由EntityManager包装)? Between Reader, Processor and Writer? 在读者,处理器和作家之间? or for each commit interval? 或每个提交间隔? We can control it or not? 我们可以控制吗?

据我所知,何时提交Spring事务(在每个块之后)。

Please, I want to know when the Hibernate session (wrapped by the EntityManager) is flushed? 请,我想知道什么时候刷新Hibernate会话(由EntityManager包装)? Between Reader, Processor and Writer? 在读者,处理器和作家之间? or for each commit interval? 或每个提交间隔?

The session is flushed after writing a chunk of items, at each commit interval. 在每个提交间隔写入大量项目后,将刷新该会话。 For more details, take a look at: 有关更多详细信息,请查看:

We can control it or not? 我们可以控制吗?

If you use the HibernateItemWriter , you can set the clearSession flag to clear the session after each chunk. 如果使用HibernateItemWriter ,则可以设置clearSession标志以清除每个块之后的会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM