Skip to content

Conversation

vbabanin
Copy link
Member

@vbabanin vbabanin commented Sep 11, 2025

@vbabanin vbabanin requested a review from Copilot September 30, 2025 15:46
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces batch support to the MongoDB Hibernate integration, enabling efficient bulk operations through JDBC PreparedStatement batching. It refactors the execution model from individual command execution to bulk write operations using MongoDB's driver bulk API.

  • Implements batch operations support for PreparedStatement (addBatch, clearBatch, executeBatch)
  • Refactors MongoStatement to use MongoDB bulk write operations instead of individual commands
  • Adds comprehensive test coverage for batch insert, update, and delete operations

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
MongoPreparedStatementTests.java Updates unit tests to reflect bulk write operations and adds new batch execution error handling tests
MongoStatement.java Refactors execution from runCommand to bulkWrite operations and adds bulk write model conversion
MongoPreparedStatement.java Implements batch support methods and batch exception handling
BatchUpdateIntegrationTests.java New integration test file for testing batch operations in real Hibernate scenarios
AbstractQueryIntegrationTests.java Updates test utilities to support multiple command assertions
MongoPreparedStatementIntegrationTests.java Adds comprehensive integration tests for batch operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@vbabanin vbabanin requested a review from Copilot October 2, 2025 17:23
Copilot

This comment was marked as resolved.

Comment on lines -189 to -206
@Override
public void addBatch(String mql) throws SQLException {
checkClosed();
throw new SQLFeatureNotSupportedException("TODO-HIBERNATE-35 https://jira.mongodb.org/browse/HIBERNATE-35");
}

@Override
public void clearBatch() throws SQLException {
checkClosed();
throw new SQLFeatureNotSupportedException("TODO-HIBERNATE-35 https://jira.mongodb.org/browse/HIBERNATE-35");
}

@Override
public int[] executeBatch() throws SQLException {
checkClosed();
closeLastOpenResultSet();
throw new SQLFeatureNotSupportedException("TODO-HIBERNATE-35 https://jira.mongodb.org/browse/HIBERNATE-35");
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not implemented because Hibernate relies on PreparedStatement methods for batching.

@vbabanin vbabanin requested a review from stIncMale October 2, 2025 23:56
@vbabanin vbabanin marked this pull request as ready for review October 2, 2025 23:59
@vbabanin vbabanin requested a review from a team as a code owner October 2, 2025 23:59

This comment was marked as resolved.

@vbabanin vbabanin removed the request for review from tom-selander October 3, 2025 00:36
@vbabanin vbabanin removed request for a team, stIncMale and tom-selander October 3, 2025 01:11
@vbabanin vbabanin self-assigned this Oct 3, 2025
@vbabanin vbabanin requested a review from Copilot October 3, 2025 01:29
Copilot

This comment was marked as resolved.

@vbabanin vbabanin requested a review from Copilot October 7, 2025 04:45
Copilot

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant