Skip to content

feat: Add QuerySpec-based createOrUpdate method Overloads to DAOs - #154

Open
abhinow-porwal wants to merge 1 commit into
santanusinha:masterfrom
abhinow-porwal:feature/add_remaining_queryspec
Open

feat: Add QuerySpec-based createOrUpdate method Overloads to DAOs#154
abhinow-porwal wants to merge 1 commit into
santanusinha:masterfrom
abhinow-porwal:feature/add_remaining_queryspec

Conversation

@abhinow-porwal

@abhinow-porwal abhinow-porwal commented Apr 21, 2026

Copy link
Copy Markdown

Summary

Adds QuerySpec-based createOrUpdate methods to RelationalDao and MultiTenantRelationalDao alongside existing DetachedCriteria versions.

Changes

  • New CreateOrUpdateByQuerySpec operation class with complete visitor pattern support
  • createOrUpdate(QuerySpec) method overloads in both DAO classes
  • BucketKeyPersistor visitor implementation for automatic bucket ID injection
  • CREATE_OR_UPDATE_BY_QUERY_SPEC added to OpType enum

Tests

  • CreateOrUpdateByQuerySpecTest - unit tests covering creation, update, and null edge cases
  • MultiTenantRelationalDaoTest.testCreateOrUpdateWithQuerySpec() - integration test
  • RelationalDaoTest.testCreateOrUpdateWithQuerySpec() - integration test

All 296 tests passing, zero regressions.


@Override
public OpType getOpType() {
return OpType.CREATE_OR_UPDATE;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should have a new value ?

abhinow-porwal pushed a commit to abhinow-porwal/dropwizard-db-sharding-bundle that referenced this pull request May 7, 2026
Addresses PR santanusinha#154 review feedback by adding complete test coverage:

Unit Tests:
- CreateOrUpdateByQuerySpecTest with 3 tests covering:
  - Entity creation path (when entity doesn't exist)
  - Entity update path (when entity exists)
  - Null entityGenerator handling

Integration Tests:
- MultiTenantRelationalDaoTest: 2 new tests
  - testCreateOrUpdateWithQuerySpec (creation and update paths)
  - testMultiShardRunWithQuerySpec (1000 entities across shards)

- RelationalDaoTest: 2 new tests
  - testCreateOrUpdateWithQuerySpec (wrapper method)
  - testRunWithQuerySpec (multi-shard queries)

Code Quality Fixes:
- Fixed indentation in MultiTenantRelationalDao (lines 150-160)
- Added JavaDoc to get(QuerySpec) method
- Enhanced JavaDoc in CreateOrUpdateByQuerySpec documenting null behavior
- Fixed OpType to use CREATE_OR_UPDATE_BY_QUERY_SPEC
- Minor cleanup in OpContext

Test Results: 298 tests passing, 0 failures, 0 regressions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@abhinow-porwal
abhinow-porwal marked this pull request as ready for review May 7, 2026 06:40
@abhinow-porwal
abhinow-porwal force-pushed the feature/add_remaining_queryspec branch 3 times, most recently from c6c2268 to 9bafa46 Compare May 7, 2026 12:24
Add QuerySpec support for createOrUpdate operations in RelationalDao and
MultiTenantRelationalDao alongside existing DetachedCriteria methods.

- New CreateOrUpdateByQuerySpec operation with visitor pattern support
- BucketKeyPersistor integration for automatic bucket ID injection
- Comprehensive unit and integration tests (296 passing)
@abhinow-porwal
abhinow-porwal force-pushed the feature/add_remaining_queryspec branch from 9bafa46 to f4af4d1 Compare May 7, 2026 12:29
@sonarqubecloud

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown

@abhinow-porwal abhinow-porwal changed the title feat: Add QuerySpec-based run and createOrUpdate method Overloads to DAOs feat: Add QuerySpec-based createOrUpdate method Overloads to DAOs May 7, 2026
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.

3 participants