Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Seam Core JSF2 2.3.0.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.seam.persistence
Class ManagedPersistenceContext

    java.lang.Object
      org.jboss.seam.persistence.ManagedPersistenceContext

All Implemented Interfaces:
  Serializable, EventListener, javax.servlet.http.HttpSessionActivationListener, Synchronization, Mutable, PersistenceContextManager

    @Scope(value=CONVERSATION)
    @BypassInterceptors
    @Install(value=false)
    public class ManagedPersistenceContext

extends Object
implements Serializable, javax.servlet.http.HttpSessionActivationListener, Mutable, PersistenceContextManager, Synchronization

A Seam component that manages a conversation-scoped extended persistence context that can be shared by arbitrary other components.

Author:
  Gavin King
See Also:
  Serialized Form

Constructor Summary
`ManagedPersistenceContext()`

Method Summary
`void` | `afterCompletion(int status)`
`void` | `beforeCompletion()`
`void` | `changeFlushMode(FlushModeType flushMode)`
`boolean` | `clearDirty()` Get and clear the dirty flag.
`void` | `create(Component component)`
`void` | `destroy()`
`String` | `getComponentName()`
`javax.persistence.EntityManager` | `getEntityManager()`
`Expressions.ValueExpression<javax.persistence.EntityManagerFactory>` | `getEntityManagerFactory()` A value binding expression that returns an EntityManagerFactory, for use of JPA outside of Java EE 5 / Embeddable EJB3.
`javax.persistence.EntityManagerFactory` | `getEntityManagerFactoryFromJndiOrValueBinding()`
`List<Filter>` | `getFilters()` Hibernate filters to enable automatically
`String` | `getPersistenceUnitJndiName()` The JNDI name of the EntityManagerFactory, for use of JPA in Java EE 5 / Embeddable EJB3.
`void` | `sessionDidActivate(javax.servlet.http.HttpSessionEvent event)` Note that we must use the method on the `HttpSessionActivationListener` interface rather than @PostActivate since interceptors are disabled on this component.
`void` | `sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)` If a transaction is active, fail the passivation.
`void` | `setEntityManagerFactory(Expressions.ValueExpression<javax.persistence.EntityManagerFactory> entityManagerFactory)`
`protected void` | `setEntityManagerFlushMode(FlushModeType flushMode)`
`void` | `setFilters(List<Filter> filters)`
`void` | `setPersistenceUnitJndiName(String persistenceUnitName)`
`String` | `toString()`

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

Constructor Detail

### ManagedPersistenceContext

    public ManagedPersistenceContext()

Method Detail

### clearDirty

    public boolean clearDirty()

  Description copied from interface: `Mutable`
  Get and clear the dirty flag.

  Specified by:
    `clearDirty` in interface `Mutable`
  Returns:
    true if the instance is dirty and requires replication

### create

    @Create
    public void create(Component component)

### getEntityManager

    @Unwrap
    public javax.persistence.EntityManager getEntityManager()
                                                     throws NamingException,
                                                            SystemException

  Throws:
    `NamingException`
    `SystemException`

### sessionWillPassivate

    public void sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)

  If a transaction is active, fail the passivation. The field holding the managed EntityManager is marked as transient so that it is not serialized (it can't be). The transient keyword was choosen because we don't want to forcefully close and nullify the EntityManager on every request because then we have to keep hitting the database to load the entities back into the persistence context. The only downside is that we cannot clean up on the old node before the session hops, but it turns out not to matter. Note that we must use the method on the `HttpSessionActivationListener` interface rather than `@PrePassivate` since interceptors are disabled on this component.

  Specified by:
    `sessionWillPassivate` in interface `javax.servlet.http.HttpSessionActivationListener`

### sessionDidActivate

    public void sessionDidActivate(javax.servlet.http.HttpSessionEvent event)

  Note that we must use the method on the `HttpSessionActivationListener` interface rather than @PostActivate since interceptors are disabled on this component.

  Specified by:
    `sessionDidActivate` in interface `javax.servlet.http.HttpSessionActivationListener`

### destroy

    @Destroy
    public void destroy()

### afterCompletion

    public void afterCompletion(int status)

  Specified by:
    `afterCompletion` in interface `Synchronization`

### beforeCompletion

    public void beforeCompletion()

  Specified by:
    `beforeCompletion` in interface `Synchronization`

### getEntityManagerFactoryFromJndiOrValueBinding

    public javax.persistence.EntityManagerFactory getEntityManagerFactoryFromJndiOrValueBinding()

### getEntityManagerFactory

    public Expressions.ValueExpression<javax.persistence.EntityManagerFactory> getEntityManagerFactory()

  A value binding expression that returns an EntityManagerFactory, for use of JPA outside of Java EE 5 / Embeddable EJB3.

### setEntityManagerFactory

    public void setEntityManagerFactory(Expressions.ValueExpression<javax.persistence.EntityManagerFactory> entityManagerFactory)

### getPersistenceUnitJndiName

    public String getPersistenceUnitJndiName()

  The JNDI name of the EntityManagerFactory, for use of JPA in Java EE 5 / Embeddable EJB3.

### setPersistenceUnitJndiName

    public void setPersistenceUnitJndiName(String persistenceUnitName)

### getComponentName

    public String getComponentName()

### getFilters

    public List<Filter> getFilters()

  Hibernate filters to enable automatically

### setFilters

    public void setFilters(List<Filter> filters)

### changeFlushMode

    public void changeFlushMode(FlushModeType flushMode)

  Specified by:
    `changeFlushMode` in interface `PersistenceContextManager`

### setEntityManagerFlushMode

    protected void setEntityManagerFlushMode(FlushModeType flushMode)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Seam Core JSF2 2.3.0.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 Seam Framework. All Rights Reserved.