You must create a helper method which performs the state transition.
/**
* Transitions this entity to the new state specified.
*
* @param newState
* the state to transition to
* @param versionNo
* the version number of this entity as previously
* retrieved
* @throws InformationalException
* if validation errors occur during the transition
*/
private void transitionTo(
final State<MYLIFECYCLEENTITYSTATEEntry> newState,
final Integer versionNo) throws InformationalException {
// get the current state of this entity
final State<MYLIFECYCLEENTITYSTATEEntry> oldState =
getState();
// set the field which stores the state value
setState(newState);
// validate the state transition
oldState.transitionTo(newState);
// update the database, bypassing any pre-modify validation
// in this class
super.modify(versionNo);
}