Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
AWare
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h2>Overview</h2> <p>The <strong>Transactional Mixin</strong> is a mixin that allows you to add additional behaviour to the objects that you have defined as <em>transactional</em>. </p> <p>It provides convience methods that the developer can use to interact with the <a class="confluence-link" href="/display/AWARE/Unit+Of+Work" data-linked-resource-id="3415" data-linked-resource-type="page" data-linked-resource-default-alias="Unit Of Work" data-base-url="http://docs.codehaus.org">Unit Of Work</a>. </p> <p>Here is the <code>org.codehaus.aware.unitofwork.Transactional</code> interface that you can use to access the introduced methods:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> public interface Transactional { /** * Stores the persistable object in persistent storage. */ void create(); /** * Removes the persistable object from persistent storage. */ void remove(); /** * Clones the persistable object. * * @return a clone of the persistable object */ Object clone(); /** * Checks if the persistable object exists in the persistent storage. * * @return true if the object exists in the persistent storage */ boolean exists(); /** * Marks the persistable object as dirty. <p/>Is handled automatically by the framework but this method exists for * the users to be able to do it explicitly. */ void markDirty(); /** * Marks the current UnitOfWork and attached transaction as restoreObject only. */ void setRollbackOnly(); /** * Returns the current UnitOfWork. * * @return the current UnitOfWork */ UnitOfWork getUnitOfWork(); /** * Returns the current transaction. * * @return the current transaction */ TransactionContext getTransaction(); } </pre></td></tr></table> <p>To access the methods you have to cast the instance to the interface:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ((Transactional)this).setRollbackOnly() </pre></td></tr></table> <p>or</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ((Transactional)targetInstance).create() </pre></td></tr></table> <h2>Definition</h2> <p>The <strong>Transactional Mixin</strong> is an inner class of the <a class="confluence-link" href="/display/AWARE/UnitOfWorkProtocol" data-linked-resource-id="3460" data-linked-resource-type="page" data-linked-resource-default-alias="UnitOfWorkProtocol" data-base-url="http://docs.codehaus.org">UnitOfWorkProtocol</a> and is defined using the <code>transactionalObjects</code> pointcut. </p> <p>This is how you can define it in the XML definition:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <aspect class="org.codehaus.aware.unitofwork.UnitOfWorkProtocol"> <pointcut name="transactionalObjects" expression="within(org.codehaus.aware.app.domain.*)"/> ... </aspect> </pre></td></tr></table>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced