org.jboss.portal.test.framework.embedded
Class HibernateSupport

java.lang.Object
  extended by org.jboss.portal.test.framework.embedded.HibernateSupport

public class HibernateSupport
extends java.lang.Object

Version:
$Revision: 7821 $
Author:
Julien Viet

Nested Class Summary
static class HibernateSupport.Config
           
 
Field Summary
protected  org.hibernate.cfg.Configuration cfg
          .
protected  HibernateSupport.Config config
          .
protected  org.hibernate.SessionFactory factory
          .
protected  java.lang.String jndiName
          .
protected  org.apache.log4j.Logger log
          .
protected  java.util.Collection mappings
          .
protected  org.hibernate.Session session
          .
protected  org.hibernate.cfg.Settings settings
          .
 
Constructor Summary
HibernateSupport()
           
 
Method Summary
 boolean commitTransaction()
          Try to commit the transaction and return true if the commit was succesful
 void create()
           
protected  void createConfiguration()
           
protected  void createSchema()
           
protected  void createSessionFactory()
           
 void destroy()
           
protected  void destroyConfiguration()
           
protected  void destroySchema()
           
protected  void destroySessionFactory()
           
static java.util.Map fromXML(java.net.URL url)
           
 HibernateSupport.Config getConfig()
           
static HibernateSupport.Config getConfig(java.lang.String name)
           
 org.hibernate.Session getCurrentSession()
           
 java.lang.String getJNDIName()
           
 java.util.Collection getMappings()
           
 org.hibernate.SessionFactory getSessionFactory()
           
 org.hibernate.Session openSession()
           
 void rollbackTransaction()
          Rollback the transaction and return true if the rollback was succesful
 void setConfig(HibernateSupport.Config config)
           
 void setJNDIName(java.lang.String jndiName)
           
 void setMappings(java.util.Collection mappings)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.log4j.Logger log
.


jndiName

protected java.lang.String jndiName
.


mappings

protected java.util.Collection mappings
.


config

protected HibernateSupport.Config config
.


factory

protected org.hibernate.SessionFactory factory
.


session

protected org.hibernate.Session session
.


cfg

protected org.hibernate.cfg.Configuration cfg
.


settings

protected org.hibernate.cfg.Settings settings
.

Constructor Detail

HibernateSupport

public HibernateSupport()
Method Detail

getMappings

public java.util.Collection getMappings()

setMappings

public void setMappings(java.util.Collection mappings)

getConfig

public HibernateSupport.Config getConfig()

setConfig

public void setConfig(HibernateSupport.Config config)

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()

getJNDIName

public java.lang.String getJNDIName()

setJNDIName

public void setJNDIName(java.lang.String jndiName)

createConfiguration

protected void createConfiguration()

createSessionFactory

protected void createSessionFactory()

createSchema

protected void createSchema()

destroySchema

protected void destroySchema()

destroySessionFactory

protected void destroySessionFactory()

destroyConfiguration

protected void destroyConfiguration()

create

public void create()
            throws java.lang.Exception
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Throws:
java.lang.Exception

destroy

public void destroy()

commitTransaction

public boolean commitTransaction()
Try to commit the transaction and return true if the commit was succesful


rollbackTransaction

public void rollbackTransaction()
Rollback the transaction and return true if the rollback was succesful


getCurrentSession

public org.hibernate.Session getCurrentSession()

openSession

public org.hibernate.Session openSession()

fromXML

public static java.util.Map fromXML(java.net.URL url)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getConfig

public static HibernateSupport.Config getConfig(java.lang.String name)
                                         throws java.lang.Exception
Throws:
java.lang.Exception