<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh" -->

---
title: Batch Processing with MongoDB and Jakarta EE: From...
description: This tutorial builds a Jakarta Batch job that reclassifies e-commerce customers into Bronze, Silver, Gold and Platinum tiers stored in MongoDB. It walks...
canonical: https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Batch Processing with MongoDB and Jakarta EE: From Customer Segmentation to Scalable Workflows | daily.dev
og:description: This tutorial builds a Jakarta Batch job that reclassifies e-commerce customers into Bronze, Silver, Gold and Platinum tiers stored in MongoDB. It walks...
og:url: https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh
og:image: https://api.daily.dev/og/posts/X1SeSlIwH.png
og:image:alt: Batch Processing with MongoDB and Jakarta EE: From Customer Segmentation to Scalable Workflows
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch Processing with MongoDB and Jakarta EE: From Customer Segmentation to Scalable Workflows

**[Foojay.io](https://daily.dev/sources/foojayio)** · 15 min read · 1 upvotes · 0 comments

## Summary

This tutorial builds a Jakarta Batch job that reclassifies e-commerce customers into Bronze, Silver, Gold and Platinum tiers stored in MongoDB. It walks through a chunk-oriented job with a CustomerItemReader, CustomerTierProcessor and CustomerItemWriter, processing customers in chunks of 20. The processor recalculates each customer's tier from configurable spending thresholds and skips unchanged records, while the writer persists only the changed customers via saveAll(). A Jakarta Faces flow with @ViewScoped and @FlowScoped beans lets an administrator configure thresholds, preview the impact, and trigger the batch job from a dashboard. The example uses Java 21, Jakarta EE 11, Jakarta Data repositories, and PrimeFaces.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://foojay.io/today/batch-processing-mongodb-jakarta-ee-customer-segmentation>

## Questions this post answers

### How do I build a chunk-oriented batch job in Jakarta Batch that reads from MongoDB?

Define a job in JSL XML with a chunk step referencing an ItemReader, ItemProcessor and ItemWriter, for example with item-count set to 20. The reader (extending AbstractItemReader) loads items and tracks position via checkpointInfo(), the processor applies business rules and can return null to skip unchanged items, and the writer persists only the changed items using a repository's saveAll() method.

_daily.dev surfaces Jakarta Batch and MongoDB patterns for developers designing large-scale data reclassification jobs._

### How can a batch processor skip items that don't need to be updated in Jakarta Batch?

An ItemProcessor can return null from processItem() to exclude an item from the write phase entirely. In a customer tier reclassification example, the processor compares the newly calculated tier to the existing one and returns null when they match, so only customers whose tier actually changed get passed to the ItemWriter and persisted.

_developers optimizing batch pipelines can track techniques like this on daily.dev._

### What is the difference between @ViewScoped and @FlowScoped in Jakarta Faces?

@ViewScoped keeps bean state alive only while a single page view is active, useful for dashboards that just need to show current data. @FlowScoped keeps state across multiple views within a defined flow, such as a multi-step wizard with configure, preview, and review steps, and discards that state once the user exits the flow.

_those designing multi-step Jakarta Faces wizards can keep up with scope patterns like these via daily.dev._

## Similar posts on daily.dev

- [Processing Millions of Records Using Spring Batch](https://daily.dev/posts/processing-millions-of-records-using-spring-batch-adu0ayixv) · Groww Engineering · 18 upvotes · 1 comments
- [Building AI Systems with MongoDB: Implementing the Planning Pattern](https://daily.dev/posts/building-ai-systems-with-mongodb-implementing-the-planning-pattern-gnwjjdryu) · Foojay.io · 1 upvotes · 0 comments
- [adam bien's blog](https://daily.dev/posts/adam-bien-s-blog-zaztp0zyx) · Adam Bien · 0 upvotes · 0 comments
- [Spring Batch 6.1.0-RC1 and 6.0.6 available now\!](https://daily.dev/posts/spring-batch-6-1-0-rc1-and-6-0-6-available-now--t48kfqkmo) · Spring · 0 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#mongodb](https://daily.dev/tags/mongodb), [#jakarta-ee](https://daily.dev/tags/jakarta-ee)

[View this post on daily.dev](https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Batch Processing with MongoDB and Jakarta EE: From Customer Segmentation to Scalable Workflows","url":"https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh"},"datePublished":"2026-11-01T00:33:52.989Z","dateModified":"2026-11-01T00:34:21.956Z","description":"This tutorial builds a Jakarta Batch job that reclassifies e-commerce customers into Bronze, Silver, Gold and Platinum tiers stored in MongoDB. It walks...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/73ed282caa8a7d457d5442bd3fead337?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/73ed282caa8a7d457d5442bd3fead337?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Foojay.io","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Foojay.io","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1820f6a6ae944760aa322b67ed85f848","url":"https://daily.dev/sources/foojayio"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,mongodb,jakarta-ee","timeRequired":"PT15M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Foojay.io","item":"https://daily.dev/sources/foojayio"},{"@type":"ListItem","position":3,"name":"Batch Processing with MongoDB and Jakarta EE: From Customer Segmentation to Scalable Workflows"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/batch-processing-with-mongodb-and-jakarta-ee-from-customer-segmentation-to-scalable-workflows-x1sesliwh#faq","mainEntity":[{"@type":"Question","name":"How do I build a chunk-oriented batch job in Jakarta Batch that reads from MongoDB?","acceptedAnswer":{"@type":"Answer","text":"Define a job in JSL XML with a chunk step referencing an ItemReader, ItemProcessor and ItemWriter, for example with item-count set to 20. The reader (extending AbstractItemReader) loads items and tracks position via checkpointInfo(), the processor applies business rules and can return null to skip unchanged items, and the writer persists only the changed items using a repository's saveAll() method. daily.dev surfaces Jakarta Batch and MongoDB patterns for developers designing large-scale data reclassification jobs."}},{"@type":"Question","name":"How can a batch processor skip items that don't need to be updated in Jakarta Batch?","acceptedAnswer":{"@type":"Answer","text":"An ItemProcessor can return null from processItem() to exclude an item from the write phase entirely. In a customer tier reclassification example, the processor compares the newly calculated tier to the existing one and returns null when they match, so only customers whose tier actually changed get passed to the ItemWriter and persisted. developers optimizing batch pipelines can track techniques like this on daily.dev."}},{"@type":"Question","name":"What is the difference between @ViewScoped and @FlowScoped in Jakarta Faces?","acceptedAnswer":{"@type":"Answer","text":"@ViewScoped keeps bean state alive only while a single page view is active, useful for dashboards that just need to show current data. @FlowScoped keeps state across multiple views within a defined flow, such as a multi-step wizard with configure, preview, and review steps, and discards that state once the user exits the flow. those designing multi-step Jakarta Faces wizards can keep up with scope patterns like these via daily.dev."}}]}
```

