net.sf.cantina.datasource
Class HibernateDataSource
java.lang.Object
net.sf.cantina.DataSource
net.sf.cantina.datasource.HibernateDataSource
- Direct Known Subclasses:
- HypersonicDataSource, UserDefinedDataSource
- public abstract class HibernateDataSource
- extends DataSource
This class configures hibernate and provides access to sessions.
- Author:
- Stephane JAIS
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HibernateDataSource
public HibernateDataSource()
getSessionFactory
public abstract net.sf.hibernate.SessionFactory getSessionFactory()
closeSessionFactory
public abstract void closeSessionFactory()
throws java.lang.Exception
- Throws:
java.lang.Exception
getThreadLocalSession
protected abstract java.lang.ThreadLocal getThreadLocalSession()
- The hibernate session is stored in a ThreadLocal.
getSession
public net.sf.hibernate.Session getSession()
throws net.sf.hibernate.HibernateException
- Gets/create the hibernate session.
- Throws:
net.sf.hibernate.HibernateException
- See Also:
closeSession()
closeSession
public void closeSession()
- Close the hibernate (SQL) connection.
- Specified by:
closeSession
in class DataSource
- See Also:
getSession()
release
public void release()
- Releases all the hibernate resources.
- Specified by:
release
in class DataSource
load
public java.lang.Object load(java.lang.String id,
java.lang.Class clazz)
throws java.lang.Exception
- Throws:
java.lang.Exception
createDocument
public void createDocument(java.lang.String documentId)
throws DuplicateKeyException,
java.lang.Exception
- Specified by:
createDocument
in class DataSource
- Throws:
DuplicateKeyException
java.lang.Exception
loadDocument
public Document loadDocument(java.lang.String documentId)
throws java.lang.Exception
- Specified by:
loadDocument
in class DataSource
- Throws:
java.lang.Exception
saveDocument
public void saveDocument(Document d)
throws java.lang.Exception
- Specified by:
saveDocument
in class DataSource
- Throws:
java.lang.Exception
removeDocument
public void removeDocument(java.lang.String documentId)
throws java.lang.Exception
- Specified by:
removeDocument
in class DataSource
- Throws:
java.lang.Exception
loadRealm
public Realm loadRealm(java.lang.String name)
throws ObjectNotFoundException,
java.lang.Exception
- Specified by:
loadRealm
in class DataSource
- Throws:
ObjectNotFoundException
java.lang.Exception
saveRealm
public void saveRealm(Realm r)
throws java.lang.Exception
- Specified by:
saveRealm
in class DataSource
- Throws:
java.lang.Exception
createRealm
public void createRealm(java.lang.String name)
throws java.lang.Exception
- Specified by:
createRealm
in class DataSource
- Throws:
java.lang.Exception
removeRealm
public void removeRealm(java.lang.String name)
throws java.lang.Exception
- Specified by:
removeRealm
in class DataSource
- Throws:
java.lang.Exception
findAllRealms
public java.util.Collection findAllRealms()
throws java.lang.Exception
- Specified by:
findAllRealms
in class DataSource
- Throws:
java.lang.Exception
selectAllDocumentIds
public java.util.Collection selectAllDocumentIds()
throws java.lang.Exception
- Specified by:
selectAllDocumentIds
in class DataSource
- Throws:
java.lang.Exception
Copyright © 2004 Cantina. All Rights Reserved.