Correct Answer: A, D
Explanation:
In Guidewire InsuranceSuite, Bundle Management is the core mechanism for managing database transactions. When you retrieve an entity via a query, as seen in the code sample, that entity is in read-only mode. To modify it and persist those changes, the entity must be associated with a Bundle.
1. Adding the Entity to the Bundle (Option D)
The code sample retrieves a company object, but it is currently 'read-only' because it was fetched outside of the newBundle context. To make the entity editable, you must explicitly add it to the bundle using the add() method:
company = newBundle.add(company)
company.Notes = 'TBD'
By adding the entity to the bundle, Gosu creates a 'writable' clone of the object. Any changes made to the properties of this specific instance are tracked by the bundle. Without this step, setting company.Notes = 'TBD' would result in a runtime exception stating that the entity is read-only.
2. Committing the Changes (Option A)
A bundle acts as a temporary 'staging area' for changes. Simply modifying an object within a bundle does not automatically update the database. To persist the data, the developer must explicitly call the commit method:
newBundle.commit()
This triggers the database transaction, executing the necessary SQL UPDATE statements and clearing the bundle's state upon success.
Why other options are incorrect: * Option E describes the syntax for a runWithNewBundle block. While using runWithNewBundle is considered a best practice because it handles the commit and exception logic automatically, the question specifically asks what needs to be changed in the provided procedural code.
Option B and C are incorrect because you do not add 'Notes' (a property) or a 'Query' object to a bundle; you only add Entities that you intend to modify or create.