JBoss seam 2 part
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,214
On Slideshare
2,211
From Embeds
3
Number of Embeds
2

Actions

Shares
Downloads
10
Comments
0
Likes
0

Embeds 3

http://www.linkedin.com 2
http://paper.li 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Conversation and ORM
    • Introduction to conversation
    • 2. Nested conversations
    • 3. Page flow and back button
    • 4. Persistence context
    • 5. JPA ”delegate”
    • 6. Exception handling
    • 7. Q&A
  • 8. Conversations
    • Keep objects for linked pages or actions
    • 9. Transparently propogates the state of objects
    • 10. No issues with concurrent states
    • 11. Back button support
    • 12. Full management by API
  • 13. Conversation's lifecycle
    • Temporary conversation is exists
    • 14. Restore at the end of restore view phase of JSF (cid=xxx - request parameter)
    • 15. @Begin starts a long-running conversation
    • 16. @End finishes a long-running conversation
    • 17. Store at the end of render phase of JSF
    • 18. Destroy the contents of a temporary conversation
    • 19. Any faces requests will propogate the conversation context
  • 20. Simple example
      @Name(”invoiceAction”) @AutoCreate @Scope(CONVERSATION) public class InvoiceAction implements Serializable {
        private Invoice currentInvoice; @Begin public void start(Long invoiceId) { currentInvoice = em.find(Invoice.class, invoiceId) } @End(beforeRedirect = true) public String update() { em.merge(currentInvoice); return ”success”; } }
  • 21. How to start conversation
    • @Begin, @Begin(nested=true), @Begin(join=true)
    • 22. <begin-conversation/> in pages.xml
    • 23. <s:link propogation=”?”/>, <s:button propogation=”?”/>
    • 24. <s:conversationPropogation/> for <h:commandLink/>, <h:commandButton/>
    • 25. Conversation.instance().begin()
  • 26. How to finish conversation
    • @End
    • 27. <end-conversation/> in pages.xml
    • 28. <s:link propogation=”end”/>, <s:button propogation=”end”/>
    • 29. <s:conversationPropogation type=”end”/>
    • 30. Conversation.instance().end()
  • 31. Nested conversation
    • Conversation stack
    • 32. No affects for outjected values with same name
    • 33. Injection by conversation stack
    • 34. Parent conversation finishes all nested conversations
  • 35. Page flow
      <page view-id=&quot;/numberGuess.jsp&quot; no-conversation-view-id=”/main.jsp” login-required=”true” scheme=”http”> <restrict>#{s:hasRole('admin')}</restrict> <navigation> <rule if-outcome=&quot;guess&quot;> <begin-conversation/> <redirect view-id=&quot;/numberGuess.jsp&quot;/> </rule> <rule if-outcome=&quot;win&quot;> <end-conversation before-redirect=”true”/> <redirect view-id=&quot;/win.jsp&quot;/> </rule> <rule if=&quot;#{seamComponent.check}&quot;> <redirect view-id=&quot;/lose.jsp&quot;/> </rule> </navigation> </page>
  • 36. Back button
    • <page name=&quot;checkout&quot;
    • 37. view-id=&quot;/checkout.xhtml&quot;
    • 38. back=&quot;enabled&quot;/>
    • 39. Nested conversations
  • 40. Extended persistence context
    • Pattern ”open session in view” is obsolete
    • 41. Increase scope of persistence context to conversation scope
    • 42. Optimized for EJB containers
    • 43. @PersistenceContext
    • 44. @In
    • 45. private EntityManager entityManager;
  • 46. JPA ”delegate”
    • (Session) entityManager.getDelegate()
    • 47. <factory name=&quot;session&quot;
    • 48. scope=&quot;STATELESS&quot;
    • 49. auto-create=&quot;true&quot;
    • 50. value=&quot;#{entityManager.delegate}&quot;/>
    • 51. @In
    • 52. private Session session;
  • 53. Managing exceptions
    • @ApplicationException(rollback=true, message=”some text”)
    • 54. PersistenceException