java - Spring-Batch/JPA : Share Persistence Context between reader,processor and writer -
java - Spring-Batch/JPA : Share Persistence Context between reader,processor and writer -
we're on web application have batch processing.
we're facing performances problems. we're using spring batch , jpa (with hibernate implementation), no ejb's.
for moment we're using hibernatecursoritemreader load info , jpaitemwriter create updates.
i'm searching while best pattern optimize our batch. i've seen many give-and-take , documentation people unadvise utilize extended persistence context many problems getting outofmemory error, non threadsafe object...
but in our case, talk batch processing there 1 persistence context @ 1 time. planed flush , clear entitymanager after each chunk, wich persist item 1 1 (commit size = 1).
so don't see why not utilize 1 persistence context reader, processor , writer. thought avoid many select (at to the lowest degree 1 per item) reattach detached item between reader , author (so entitymanager can merge without making select).
so i'm wondering if have recommendation pattern.
and how implement properly, because not defaut behavior spring batch. in fact have override persistence context property transactional web application, , injected @persistencecontext annotation.
edit : forget we're on tomcat 7 server
java hibernate jpa spring-batch entitymanager
Comments
Post a Comment