pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util
Class HibernateDataSourceImpl

java.lang.Object
  extended by org.torweg.pulse.util.HibernateDataSourceImpl
All Implemented Interfaces:
HibernateDataSource

public class HibernateDataSourceImpl
extends java.lang.Object
implements HibernateDataSource

Implementation of the HibernateDataSource.

Version:
$Revision: 2050 $
Author:
Thomas Weber

Constructor Summary
HibernateDataSourceImpl(org.w3c.dom.Document configDoc, java.util.Collection<java.lang.Class<? extends java.lang.Object>> additionalClasses, java.lang.String sessionFactoryJNDI)
          Constructs a new HibernateDataSourceImpl.
 
Method Summary
 void close()
          closes the underlying Session-Factory and removes it from JNDI.
 org.hibernate.search.FullTextSession createNewSession()
          Returns a newly created Session.
 void evict(java.lang.Class<?> persistentClass)
          evicts all entries from the second-level cache.
 void evict(java.lang.Class<?> persistentClass, java.io.Serializable id)
          evicts an entry from the second-level cache.
 void evictCollection(java.lang.String roleName)
          evicts all entries from the second-level cache.
 void evictCollection(java.lang.String roleName, java.io.Serializable id)
          evicts an entry from the second-level cache.
 void evictEntity(java.lang.String entityName)
          evicts all entries from the second-level cache.
 void evictEntity(java.lang.String entityName, java.io.Serializable id)
          evicts an entry from the second-level cache.
 org.hibernate.stat.Statistics getStatistics()
          returns the Statistics of the HibernateTM session factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateDataSourceImpl

public HibernateDataSourceImpl(org.w3c.dom.Document configDoc,
                               java.util.Collection<java.lang.Class<? extends java.lang.Object>> additionalClasses,
                               java.lang.String sessionFactoryJNDI)
Constructs a new HibernateDataSourceImpl.

Parameters:
configDoc - the configuration from pulse.xml
additionalClasses - additional annotated classes from the bundles. *
sessionFactoryJNDI - the SessionFactory's name in JNDI
Method Detail

close

public final void close()
closes the underlying Session-Factory and removes it from JNDI.


createNewSession

public final org.hibernate.search.FullTextSession createNewSession()
Returns a newly created Session.The calling class is responsible for closing this Session!

Specified by:
createNewSession in interface HibernateDataSource
Returns:
Returns a newly created Session.

getStatistics

public final org.hibernate.stat.Statistics getStatistics()
returns the Statistics of the HibernateTM session factory.

Specified by:
getStatistics in interface HibernateDataSource
Returns:
the statistics

evict

public final void evict(java.lang.Class<?> persistentClass)
evicts all entries from the second-level cache.

This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.

Specified by:
evict in interface HibernateDataSource
Parameters:
persistentClass - the persistent class to be evicted
See Also:
HibernateDataSource.evict(java.lang.Class), SessionFactory.evict(Class)

evict

public final void evict(java.lang.Class<?> persistentClass,
                        java.io.Serializable id)
evicts an entry from the second-level cache.

This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.

Specified by:
evict in interface HibernateDataSource
Parameters:
persistentClass - the persistent class to be evicted
id - the id of the entry
See Also:
HibernateDataSource.evict(java.lang.Class, java.io.Serializable), SessionFactory.evict(Class,Serializable)

evictCollection

public final void evictCollection(java.lang.String roleName)
evicts all entries from the second-level cache.

This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.

Specified by:
evictCollection in interface HibernateDataSource
Parameters:
roleName - the collection to be evicted (eg. "cat.kittens")
See Also:
HibernateDataSource.evictCollection(java.lang.String), SessionFactory.evictCollection(String)

evictCollection

public final void evictCollection(java.lang.String roleName,
                                  java.io.Serializable id)
evicts an entry from the second-level cache.

This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.

Specified by:
evictCollection in interface HibernateDataSource
Parameters:
roleName - the collection to be evicted (eg. "cat.kittens")
id - the id of the collection's parent
See Also:
HibernateDataSource.evictCollection(java.lang.String , java.io.Serializable), SessionFactory.evictCollection(String,Serializable)

evictEntity

public final void evictEntity(java.lang.String entityName)
evicts all entries from the second-level cache.

This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.

Specified by:
evictEntity in interface HibernateDataSource
Parameters:
entityName - the name of the entity to be removed (eg. "cat")
See Also:
HibernateDataSource.evictEntity(java.lang.String), SessionFactory.evictEntity(String)

evictEntity

public final void evictEntity(java.lang.String entityName,
                              java.io.Serializable id)
evicts an entry from the second-level cache.

This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.

Specified by:
evictEntity in interface HibernateDataSource
Parameters:
entityName - the collection to be evicted (eg. "cat")
id - the id of the entity
See Also:
HibernateDataSource.evictEntity(java.lang.String, java.io.Serializable), SessionFactory.evictEntity(String,Serializable)