com.vaadin.addon.jpacontainer.provider.jndijta
Class EntityProvider<T>

java.lang.Object
  extended by com.vaadin.addon.jpacontainer.provider.LocalEntityProvider<T>
      extended by com.vaadin.addon.jpacontainer.provider.jndijta.EntityProvider<T>
Type Parameters:
T -
All Implemented Interfaces:
EntityProvider<T>, JndiJtaProvider<T>, Serializable

public class EntityProvider<T>
extends LocalEntityProvider<T>
implements JndiJtaProvider<T>

An entity provider implementation that uses JTA transactions and JPA context provided by the application server. To provide a generic non EJB provider this class gets references to both UserTransaction and EntityManager via JNDI lookup.

See Also:
Serialized Form

Constructor Summary
EntityProvider(Class<T> entityClass)
           
EntityProvider(Class<T> entityClass, JndiAddresses jndiAddresses)
           
 
Method Summary
 javax.persistence.EntityManager getEntityManager()
          Gets the entity manager.
 JndiAddresses getJndiAddresses()
           
 boolean isEntitiesDetached()
          If this method returns true, all entities returned from this entity provider are explicitly detached from the persistence context before returned, regardless of whether the persistence context is extended or transaction-scoped.
 void setJndiAddresses(JndiAddresses addresses)
           
 
Methods inherited from class com.vaadin.addon.jpacontainer.provider.LocalEntityProvider
addPrimaryKeyToSortList, containsEntity, createFilteredQuery, createSiblingQuery, createUnsortedFilteredQuery, detachEntity, doContainsEntity, doGetAllEntityIdentifiers, doGetEntity, doGetEntityCount, doGetEntityIdentifierAt, doGetEntityManager, doGetFirstEntityIdentifier, doGetLastEntityIdentifier, doGetNextEntityIdentifier, doGetPreviousEntityIdentifier, getAllEntityIdentifiers, getEntity, getEntityClassMetadata, getEntityCount, getEntityIdentifierAt, getEntityManagerProvider, getFirstEntityIdentifier, getIdentifier, getLastEntityIdentifier, getLazyLoadingDelegate, getNextEntityIdentifier, getPreviousEntityIdentifier, getQueryModifierDelegate, getSibling, readResolve, refresh, refreshEntity, setEntitiesDetached, setEntityManager, setEntityManagerProvider, setLazyLoadingDelegate, setQueryModifierDelegate, translateSortBy, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.addon.jpacontainer.EntityProvider
containsEntity, getAllEntityIdentifiers, getEntity, getEntityCount, getEntityIdentifierAt, getEntityManagerProvider, getFirstEntityIdentifier, getIdentifier, getLastEntityIdentifier, getLazyLoadingDelegate, getNextEntityIdentifier, getPreviousEntityIdentifier, getQueryModifierDelegate, refresh, refreshEntity, setEntitiesDetached, setEntityManager, setEntityManagerProvider, setLazyLoadingDelegate, setQueryModifierDelegate
 

Constructor Detail

EntityProvider

public EntityProvider(Class<T> entityClass)

EntityProvider

public EntityProvider(Class<T> entityClass,
                      JndiAddresses jndiAddresses)
Method Detail

isEntitiesDetached

public boolean isEntitiesDetached()
Description copied from interface: EntityProvider
If this method returns true, all entities returned from this entity provider are explicitly detached from the persistence context before returned, regardless of whether the persistence context is extended or transaction-scoped. Thus, no lazy-loaded associations will work and any changes made to the entities will not be reflected in the persistence context unless the entity is merged.

If this method returns false, the entities returned may be managed or detached, depending on the scope of the persistence context.

The default value is implementation specific.

Specified by:
isEntitiesDetached in interface EntityProvider<T>
Overrides:
isEntitiesDetached in class LocalEntityProvider<T>
Returns:
true if the entities are explicitly detached, false otherwise.
See Also:
EntityProvider.setEntitiesDetached(boolean)

getEntityManager

public javax.persistence.EntityManager getEntityManager()
Description copied from class: LocalEntityProvider
Gets the entity manager. If no entity manager has been set, the one returned by the registered entity manager provider is returned.

Specified by:
getEntityManager in interface EntityProvider<T>
Overrides:
getEntityManager in class LocalEntityProvider<T>
Returns:
the entity manager.

setJndiAddresses

public void setJndiAddresses(JndiAddresses addresses)
Specified by:
setJndiAddresses in interface JndiJtaProvider<T>
Parameters:
addresses - JNDI addresses that the provider should uses to lookup UserTransaction and EntityManager

getJndiAddresses

public JndiAddresses getJndiAddresses()
Specified by:
getJndiAddresses in interface JndiJtaProvider<T>
Returns:
settings that are used for JNDI lookups for UserTransaction and EntityManager


Copyright © 2013 Vaadin Ltd. All rights reserved.