// We need to reload a "JPA attached" mailbox, because the provide mailbox is already "JPA detached"
// If we don't this, we will get an org.apache.openjpa.persistence.ArgumentException.
((AbstractJPAMessage) message).setMailbox(getEntityManager().find(JPAMailbox.class, mailbox.getMailboxId()));
getEntityManager().persist(message);
return new SimpleMessageMetaData(message);
} catch (PersistenceException e) {
throw new MailboxException("Save of message " + message + " failed in mailbox " + mailbox, e);
} catch (ArgumentException e) {
throw new MailboxException("Save of message " + message + " failed in mailbox " + mailbox, e);
}