[
https://issues.apache.org/jira/browse/ISIS-1476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15436675#comment-15436675
]
ASF subversion and git services commented on ISIS-1476:
-------------------------------------------------------
Commit 882a2ede3a7a75c30260e1ecce63e58e9194b3ab in isis's branch
refs/heads/master from [~danhaywood]
[ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=882a2ed ]
Merge branch 'ISIS-1476_pr' of https://github.com/oscarbou/isis into
ISIS-1476_pr-49
> Transaction interface: Expose "clearAbortCause" for don't pick up handled
> persistence Exceptions
> ------------------------------------------------------------------------------------------------
>
> Key: ISIS-1476
> URL: https://issues.apache.org/jira/browse/ISIS-1476
> Project: Isis
> Issue Type: Improvement
> Affects Versions: 1.13.0
> Reporter: Oscar Bou
> Assignee: Dan Haywood
> Fix For: 1.13.1
>
>
> That way we avoid casting from "Transaction" to "IsisTransaction", and can
> support use cases that properly handle the Exception without further
> consequences.
> For example, creating an idempotent action that first tries to create an
> object and, if an SQLIntegrityConstraintViolationException occurs, return the
> previously persisted entity, avoiding one SELECT on massive bulk actions.
> {code}
> // {{ addMessage (action)
> @Action(semantics=SemanticsOf.IDEMPOTENT)
> public Message addMessageIdempotent(
> final String receiptHandle, final String notificationId,
> final Clob xmlContent, final String notificationType,
> final DateTime publishTime, final String payloadVersion) {
> Notification unprocessedNotification = null;
> try {
> unprocessedMessage = this.wrap(this).createMessage(receiptHandle,
> notificationId, amazonMarketplace, xmlContent,
> notificationType, publishTime, payloadVersion, sellerId);
> } catch (final JDODataStoreException e) {
> if (Iterables.filter(Throwables.getCausalChain(e),
> SQLIntegrityConstraintViolationException.class) != null) {
> ((IsisTransaction) this.transactionService.currentTransaction())
> .clearAbortCause();
> unprocessedMessage = this.wrap(this).findByReceiptHandle(
> receiptHandle);
> } else {
> throw e;
> }
> }
> return unprocessedMessage;
> }
> // }}
> {code}
> If published in the "Transaction" interface, the casting can be avoided,
> being simply:
> {code}
> this.transactionService.currentTransaction()
> .clearAbortCause();
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)