Skip to content

Stricter Handling for DAO::Update function#136

Open
jaagrit10 wants to merge 3 commits intosantanusinha:masterfrom
jaagrit10:update-handling
Open

Stricter Handling for DAO::Update function#136
jaagrit10 wants to merge 3 commits intosantanusinha:masterfrom
jaagrit10:update-handling

Conversation

@jaagrit10
Copy link

Add mandatory update operation to RelationalDao

This PR adds a new updateEntity() method to RelationalDao that enforces stricter update semantics:

  • Requires entity to exist
  • Requires mutation to succeed
  • Returns updated entity
  • Fails fast with clear exceptions

This complements the existing update() method which has more lenient behavior, giving developers choice between strict and permissive update operations.

try {
return transactionExecutor.get(tenantId).execute(dao.sessionFactory,
true,
"update",
Copy link

Choose a reason for hiding this comment

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

change the name here as well

* @throws IllegalArgumentException If the mutation process fails to create a valid updated entity.
* @throws RuntimeException If any other error occurs during the update operation.
*/
public T updateEntity(String tenantId, String parentKey, DetachedCriteria criteria,
Copy link

Choose a reason for hiding this comment

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

add test cases around this function usage

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.

2 participants