org.hibernate.search.jpa.impl
Class FullTextEntityManagerImpl

java.lang.Object
  extended by org.hibernate.search.jpa.impl.FullTextEntityManagerImpl
All Implemented Interfaces:
Serializable, javax.persistence.EntityManager, FullTextEntityManager

public class FullTextEntityManagerImpl
extends Object
implements FullTextEntityManager, Serializable

Author:
Emmanuel Bernard
See Also:
Serialized Form

Constructor Summary
FullTextEntityManagerImpl(javax.persistence.EntityManager em)
           
 
Method Summary
 void clear()
           
 void close()
           
 boolean contains(Object entity)
           
 FullTextQuery createFullTextQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... entities)
          Create a fulltext query on top of a native Lucene query returning the matching objects of type entities and their respective subclasses.
 MassIndexer createIndexer(Class<?>... types)
          Creates a MassIndexer to rebuild the indexes of some or all indexed entity types.
 javax.persistence.Query createNamedQuery(String name)
           
<T> javax.persistence.TypedQuery<T>
createNamedQuery(String name, Class<T> resultClass)
           
 javax.persistence.Query createNativeQuery(String sqlString)
           
 javax.persistence.Query createNativeQuery(String sqlString, Class resultClass)
           
 javax.persistence.Query createNativeQuery(String sqlString, String resultSetMapping)
           
<T> javax.persistence.TypedQuery<T>
createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)
           
 javax.persistence.Query createQuery(String ejbqlString)
           
<T> javax.persistence.TypedQuery<T>
createQuery(String qlString, Class<T> resultClass)
           
 void detach(Object entity)
           
<T> T
find(Class<T> entityClass, Object primaryKey)
           
<T> T
find(Class<T> entityClass, Object primaryKey, javax.persistence.LockModeType lockModeType)
           
<T> T
find(Class<T> entityClass, Object primaryKey, javax.persistence.LockModeType lockModeType, Map<String,Object> hints)
           
<T> T
find(Class<T> entityClass, Object primaryKey, Map<String,Object> hints)
           
 void flush()
           
 void flushToIndexes()
          Flush all index changes forcing Hibernate Search to apply all changes to the index not waiting for the batch limit.
 javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
           
 Object getDelegate()
           
 javax.persistence.EntityManagerFactory getEntityManagerFactory()
           
 javax.persistence.FlushModeType getFlushMode()
           
 javax.persistence.LockModeType getLockMode(Object entity)
           
 javax.persistence.metamodel.Metamodel getMetamodel()
           
 Map<String,Object> getProperties()
           
<T> T
getReference(Class<T> entityClass, Object primaryKey)
           
 SearchFactory getSearchFactory()
           
 javax.persistence.EntityTransaction getTransaction()
           
<T> void
index(T entity)
          Force the (re)indexing of a given managed object.
 boolean isOpen()
           
 void joinTransaction()
           
 void lock(Object entity, javax.persistence.LockModeType lockMode)
           
 void lock(Object entity, javax.persistence.LockModeType lockModeType, Map<String,Object> hints)
           
<T> T
merge(T entity)
           
 void persist(Object entity)
           
<T> void
purge(Class<T> entityType, Serializable id)
          Remove the entity with the type entityType and the identifier id from the index.
<T> void
purgeAll(Class<T> entityType)
          Remove all entities from of particular class and all its subclasses from the index.
 void refresh(Object entity)
           
 void refresh(Object entity, javax.persistence.LockModeType lockModeType)
           
 void refresh(Object entity, javax.persistence.LockModeType lockModeType, Map<String,Object> hints)
           
 void refresh(Object entity, Map<String,Object> hints)
           
 void remove(Object entity)
           
 void setFlushMode(javax.persistence.FlushModeType flushMode)
           
 void setProperty(String key, Object value)
           
<T> T
unwrap(Class<T> type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FullTextEntityManagerImpl

public FullTextEntityManagerImpl(javax.persistence.EntityManager em)
Method Detail

createFullTextQuery

public FullTextQuery createFullTextQuery(org.apache.lucene.search.Query luceneQuery,
                                         Class<?>... entities)
Description copied from interface: FullTextEntityManager
Create a fulltext query on top of a native Lucene query returning the matching objects of type entities and their respective subclasses.

Specified by:
createFullTextQuery in interface FullTextEntityManager
Parameters:
luceneQuery - The native Lucene query to be rn against the Lucene index.
entities - List of classes for type filtering. The query result will only return entities of the specified types and their respective subtype. If no class is specified no type filtering will take place.
Returns:
A FullTextQuery wrapping around the native Lucene wuery.

index

public <T> void index(T entity)
Description copied from interface: FullTextEntityManager
Force the (re)indexing of a given managed object. Indexation is batched per transaction: if a transaction is active, the operation will not affect the index at least until commit.

Specified by:
index in interface FullTextEntityManager
Parameters:
entity - The entity to index - must not be null.

getSearchFactory

public SearchFactory getSearchFactory()
Specified by:
getSearchFactory in interface FullTextEntityManager
Returns:
the SearchFactory instance.

purge

public <T> void purge(Class<T> entityType,
                      Serializable id)
Description copied from interface: FullTextEntityManager
Remove the entity with the type entityType and the identifier id from the index. If id == null all indexed entities of this type and its indexed subclasses are deleted. In this case this method behaves like FullTextEntityManager.purgeAll(Class).

Specified by:
purge in interface FullTextEntityManager
Parameters:
entityType - The type of the entity to delete.
id - The id of the entity to delete.

purgeAll

public <T> void purgeAll(Class<T> entityType)
Description copied from interface: FullTextEntityManager
Remove all entities from of particular class and all its subclasses from the index.

Specified by:
purgeAll in interface FullTextEntityManager
Parameters:
entityType - The class of the entities to remove.

flushToIndexes

public void flushToIndexes()
Description copied from interface: FullTextEntityManager
Flush all index changes forcing Hibernate Search to apply all changes to the index not waiting for the batch limit.

Specified by:
flushToIndexes in interface FullTextEntityManager

persist

public void persist(Object entity)
Specified by:
persist in interface javax.persistence.EntityManager

merge

public <T> T merge(T entity)
Specified by:
merge in interface javax.persistence.EntityManager

remove

public void remove(Object entity)
Specified by:
remove in interface javax.persistence.EntityManager

find

public <T> T find(Class<T> entityClass,
                  Object primaryKey)
Specified by:
find in interface javax.persistence.EntityManager

find

public <T> T find(Class<T> entityClass,
                  Object primaryKey,
                  Map<String,Object> hints)
Specified by:
find in interface javax.persistence.EntityManager

find

public <T> T find(Class<T> entityClass,
                  Object primaryKey,
                  javax.persistence.LockModeType lockModeType)
Specified by:
find in interface javax.persistence.EntityManager

find

public <T> T find(Class<T> entityClass,
                  Object primaryKey,
                  javax.persistence.LockModeType lockModeType,
                  Map<String,Object> hints)
Specified by:
find in interface javax.persistence.EntityManager

getReference

public <T> T getReference(Class<T> entityClass,
                          Object primaryKey)
Specified by:
getReference in interface javax.persistence.EntityManager

flush

public void flush()
Specified by:
flush in interface javax.persistence.EntityManager

setFlushMode

public void setFlushMode(javax.persistence.FlushModeType flushMode)
Specified by:
setFlushMode in interface javax.persistence.EntityManager

getFlushMode

public javax.persistence.FlushModeType getFlushMode()
Specified by:
getFlushMode in interface javax.persistence.EntityManager

lock

public void lock(Object entity,
                 javax.persistence.LockModeType lockMode)
Specified by:
lock in interface javax.persistence.EntityManager

lock

public void lock(Object entity,
                 javax.persistence.LockModeType lockModeType,
                 Map<String,Object> hints)
Specified by:
lock in interface javax.persistence.EntityManager

refresh

public void refresh(Object entity)
Specified by:
refresh in interface javax.persistence.EntityManager

refresh

public void refresh(Object entity,
                    Map<String,Object> hints)
Specified by:
refresh in interface javax.persistence.EntityManager

refresh

public void refresh(Object entity,
                    javax.persistence.LockModeType lockModeType)
Specified by:
refresh in interface javax.persistence.EntityManager

refresh

public void refresh(Object entity,
                    javax.persistence.LockModeType lockModeType,
                    Map<String,Object> hints)
Specified by:
refresh in interface javax.persistence.EntityManager

clear

public void clear()
Specified by:
clear in interface javax.persistence.EntityManager

detach

public void detach(Object entity)
Specified by:
detach in interface javax.persistence.EntityManager

contains

public boolean contains(Object entity)
Specified by:
contains in interface javax.persistence.EntityManager

getLockMode

public javax.persistence.LockModeType getLockMode(Object entity)
Specified by:
getLockMode in interface javax.persistence.EntityManager

setProperty

public void setProperty(String key,
                        Object value)
Specified by:
setProperty in interface javax.persistence.EntityManager

getProperties

public Map<String,Object> getProperties()
Specified by:
getProperties in interface javax.persistence.EntityManager

createQuery

public javax.persistence.Query createQuery(String ejbqlString)
Specified by:
createQuery in interface javax.persistence.EntityManager

createQuery

public <T> javax.persistence.TypedQuery<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)
Specified by:
createQuery in interface javax.persistence.EntityManager

createQuery

public <T> javax.persistence.TypedQuery<T> createQuery(String qlString,
                                                       Class<T> resultClass)
Specified by:
createQuery in interface javax.persistence.EntityManager

createNamedQuery

public javax.persistence.Query createNamedQuery(String name)
Specified by:
createNamedQuery in interface javax.persistence.EntityManager

createNamedQuery

public <T> javax.persistence.TypedQuery<T> createNamedQuery(String name,
                                                            Class<T> resultClass)
Specified by:
createNamedQuery in interface javax.persistence.EntityManager

createNativeQuery

public javax.persistence.Query createNativeQuery(String sqlString)
Specified by:
createNativeQuery in interface javax.persistence.EntityManager

createNativeQuery

public javax.persistence.Query createNativeQuery(String sqlString,
                                                 Class resultClass)
Specified by:
createNativeQuery in interface javax.persistence.EntityManager

createNativeQuery

public javax.persistence.Query createNativeQuery(String sqlString,
                                                 String resultSetMapping)
Specified by:
createNativeQuery in interface javax.persistence.EntityManager

joinTransaction

public void joinTransaction()
Specified by:
joinTransaction in interface javax.persistence.EntityManager

unwrap

public <T> T unwrap(Class<T> type)
Specified by:
unwrap in interface javax.persistence.EntityManager

getDelegate

public Object getDelegate()
Specified by:
getDelegate in interface javax.persistence.EntityManager

close

public void close()
Specified by:
close in interface javax.persistence.EntityManager

isOpen

public boolean isOpen()
Specified by:
isOpen in interface javax.persistence.EntityManager

getTransaction

public javax.persistence.EntityTransaction getTransaction()
Specified by:
getTransaction in interface javax.persistence.EntityManager

getEntityManagerFactory

public javax.persistence.EntityManagerFactory getEntityManagerFactory()
Specified by:
getEntityManagerFactory in interface javax.persistence.EntityManager

getCriteriaBuilder

public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
Specified by:
getCriteriaBuilder in interface javax.persistence.EntityManager

getMetamodel

public javax.persistence.metamodel.Metamodel getMetamodel()
Specified by:
getMetamodel in interface javax.persistence.EntityManager

createIndexer

public MassIndexer createIndexer(Class<?>... types)
Description copied from interface: FullTextEntityManager
Creates a MassIndexer to rebuild the indexes of some or all indexed entity types. Instances cannot be reused.

Specified by:
createIndexer in interface FullTextEntityManager
Parameters:
types - optionally restrict the operation to selected types
Returns:


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved