try
{
// The implementations of sequences mean that there is only a transaction
// after every n sequence values, where n is the MESSAGE_METADATA_SEQ_CONFIG.getCacheSize()
Sequence mmdSeq = getEnvironmentFacade().openSequence(getMessageMetaDataSeqDb(),
MESSAGE_METADATA_SEQ_KEY,
MESSAGE_METADATA_SEQ_CONFIG);
newMessageId = mmdSeq.get(null, 1);
}
catch (RuntimeException de)
{
throw getEnvironmentFacade().handleDatabaseException("Cannot get sequence value for new message", de);
}