Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.myfaces.orchestra.conversation
Class PersistentBackingBean

    java.lang.Object
      org.apache.myfaces.orchestra.conversation.PersistentBackingBean

All Implemented Interfaces:
  ConversationBindingListener

    public class PersistentBackingBean

extends Object
implements ConversationBindingListener

A backing bean for a view (ie a "view controller") that has an associated persistence context.

In real applications, the PersistenceContext is more likely to be on a DAO bean referenced from the backing bean than directly on the backing bean class. However that doesn't change the principles.

Constructor Summary
`PersistentBackingBean()`

Method Summary
`UserData` | `createUser()` Create a UserData object and commit it to the database.
`UserData` | `getRestartedUser()`
`void` | `invalidateAndRestartConversation()` Invalidate the conversation in which this bean lives, and then create a new bean instance (in a new conversation) and copy some data from the old to the new instance.
`void` | `invalidateConversation()` Invalidate the conversation in which this bean lives.
`UserData` | `readUser(Long id)`
`void` | `setRestartedUser(Long id)`
`void` | `updateUser(Long id, String username)`
`void` | `valueBound(ConversationBindingEvent event)`
`void` | `valueUnbound(ConversationBindingEvent event)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PersistentBackingBean

    public PersistentBackingBean()

Method Detail

### valueBound

    public void valueBound(ConversationBindingEvent event)

  Specified by:
    `valueBound` in interface `ConversationBindingListener`

### valueUnbound

    public void valueUnbound(ConversationBindingEvent event)

  Specified by:
    `valueUnbound` in interface `ConversationBindingListener`

### getRestartedUser

    public UserData getRestartedUser()

### createUser

    @Transactional
    public UserData createUser()

  Create a UserData object and commit it to the database.

  Because this method is marked with the Transactional annotation, a commit will be performed when the method returns successfully (without exception), and a rollback will be performed when the method throws an exception.

### readUser

    public UserData readUser(Long id)

### invalidateConversation

    public void invalidateConversation()

  Invalidate the conversation in which this bean lives.

  This means that the next attempt to dereference a proxy or EL expression will cause a new instance of this bean to be created. A new Conversation instance will be created to hold that bean, and a new PersistenceContext object will also be created (and then injected into this instance).

### invalidateAndRestartConversation

    public void invalidateAndRestartConversation()

  Invalidate the conversation in which this bean lives, and then create a new bean instance (in a new conversation) and copy some data from the old to the new instance.

  Using invalidateAndRestart allows information to be communicated between one instance of this bean and its replacement.

### setRestartedUser

    public void setRestartedUser(Long id)

### updateUser

    public void updateUser(Long id,
                           String username)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 The Apache Software Foundation. All Rights Reserved.