org.hibernate.jmx
Class HibernateService

java.lang.Object
  extended byorg.hibernate.util.ExternalSessionFactoryConfig
      extended byorg.hibernate.jmx.HibernateService
All Implemented Interfaces:
HibernateServiceMBean

public class HibernateService
extends ExternalSessionFactoryConfig
implements HibernateServiceMBean

Implementation of HibernateServiceMBean. Creates a SessionFactory and binds it to the specified JNDI name.

All mapping documents are loaded as resources by the MBean.

Author:
John Urberg, Gavin King
See Also:
HibernateServiceMBean, SessionFactory

Constructor Summary
HibernateService()
           
 
Method Summary
 void createSchema()
          Export the CREATE DDL to the database
 void dropSchema()
          Export the DROP DDL to the database
 String getAutoCloseSessionEnabled()
          Is automatic Session closing enabled?
 String getDatasource()
          The JNDI name of the datasource to use in this SessionFactory
protected  Map getExtraProperties()
           
 String getFlushBeforeCompletionEnabled()
          Is automatic Session flusing enabled?
 String getJndiName()
          The JNDI name to bind to the SessionFactory
 String getName()
           
 String getPassword()
          Log into the database with this password
 Properties getProperties()
           
 String getProperty(String property)
          Get a property
 String getPropertyList()
          Display the properties
 String getTransactionManagerLookupStrategy()
          Get the strategy for obtaining the JTA TransactionManager
 String getTransactionStrategy()
          The fully qualified class name of the Hibernate TransactionFactory implementation
 String getUserName()
          Log into the database with this name
 String getUserTransactionName()
          The JNDI name of the JTA UserTransaction object (used only be JTATransaction).
 void setAutoCloseSessionEnabled(String enabled)
          Enable automatic closing of Session when JTA transaction ends.
 void setDatasource(String datasource)
          Set the JNDI name of the datasource to use in this SessionFactory
 void setFlushBeforeCompletionEnabled(String enabled)
          Enable automatic flushing of the Session when JTA transaction ends.
 void setJndiName(String jndiName)
          The JNDI name to bind to the SessionFactory
 void setPassword(String password)
          Log into the database with this password
 void setProperty(String property, String value)
          Set a property
 void setTransactionManagerLookupStrategy(String lkpStrategy)
          Set the strategy for obtaining the JTA TransactionManager
 void setTransactionStrategy(String txnStrategy)
          Set the fully qualified class name of the Hibernate TransactionFactory implementation
 void setUserName(String userName)
          Log into the database with this name
 void setUserTransactionName(String utName)
          Set the JNDI name of the JTA UserTransaction object (used only by JTATransaction).
 void start()
          Create the SessionFactory and bind to the jndi name on startup
 void stop()
          Unbind the SessionFactory or stub from JNDI
 
Methods inherited from class org.hibernate.util.ExternalSessionFactoryConfig
addAdditionalProperty, addAll, addMapResource, buildConfiguration, buildProperties, getBatchVersionedDataEnabled, getCacheProviderClass, getCacheProviderConfig, getCacheRegionPrefix, getCommentsEnabled, getCustomListeners, getDefaultCatalog, getDefaultSchema, getDialect, getExcludedPropertyNames, getGetGeneratedKeysEnabled, getJdbcBatchSize, getJdbcFetchSize, getJdbcScrollableResultSetEnabled, getMapResources, getMaximumFetchDepth, getMinimalPutsEnabled, getQueryCacheEnabled, getQuerySubstitutions, getReflectionOptimizationEnabled, getSecondLevelCacheEnabled, getShowSqlEnabled, getStreamsForBinaryEnabled, setBatchVersionedDataEnabled, setCacheProviderClass, setCacheProviderConfig, setCacheRegionPrefix, setCommentsEnabled, setCustomListener, setCustomListeners, setCustomListenersAsString, setDefaultCatalog, setDefaultSchema, setDialect, setGetGeneratedKeysEnabled, setJdbcBatchSize, setJdbcFetchSize, setJdbcScrollableResultSetEnabled, setMapResources, setMaximumFetchDepth, setMinimalPutsEnabled, setQueryCacheEnabled, setQuerySubstitutions, setReflectionOptimizationEnabled, setSecondLevelCacheEnabled, setShowSqlEnabled, setStreamsForBinaryEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.jmx.HibernateServiceMBean
addMapResource, getBatchVersionedDataEnabled, getCacheProviderClass, getCacheProviderConfig, getCacheRegionPrefix, getCommentsEnabled, getDefaultCatalog, getDefaultSchema, getDialect, getGetGeneratedKeysEnabled, getJdbcBatchSize, getJdbcFetchSize, getJdbcScrollableResultSetEnabled, getMapResources, getMaximumFetchDepth, getMinimalPutsEnabled, getQueryCacheEnabled, getQuerySubstitutions, getSecondLevelCacheEnabled, getShowSqlEnabled, setBatchVersionedDataEnabled, setCacheProviderClass, setCacheProviderConfig, setCacheRegionPrefix, setCommentsEnabled, setDefaultCatalog, setDefaultSchema, setDialect, setGetGeneratedKeysEnabled, setJdbcBatchSize, setJdbcFetchSize, setJdbcScrollableResultSetEnabled, setMapResources, setMaximumFetchDepth, setMinimalPutsEnabled, setQueryCacheEnabled, setQuerySubstitutions, setSecondLevelCacheEnabled, setShowSqlEnabled
 

Constructor Detail

HibernateService

public HibernateService()
Method Detail

start

public void start()
           throws HibernateException
Description copied from interface: HibernateServiceMBean
Create the SessionFactory and bind to the jndi name on startup

Specified by:
start in interface HibernateServiceMBean
Throws:
HibernateException

stop

public void stop()
Description copied from interface: HibernateServiceMBean
Unbind the SessionFactory or stub from JNDI

Specified by:
stop in interface HibernateServiceMBean

getExtraProperties

protected Map getExtraProperties()
Overrides:
getExtraProperties in class ExternalSessionFactoryConfig

getTransactionStrategy

public String getTransactionStrategy()
Description copied from interface: HibernateServiceMBean
The fully qualified class name of the Hibernate TransactionFactory implementation

Specified by:
getTransactionStrategy in interface HibernateServiceMBean
Returns:
the class name
See Also:
TransactionFactory

setTransactionStrategy

public void setTransactionStrategy(String txnStrategy)
Description copied from interface: HibernateServiceMBean
Set the fully qualified class name of the Hibernate TransactionFactory implementation

Specified by:
setTransactionStrategy in interface HibernateServiceMBean
Parameters:
txnStrategy - the class name
See Also:
TransactionFactory

getUserTransactionName

public String getUserTransactionName()
Description copied from interface: HibernateServiceMBean
The JNDI name of the JTA UserTransaction object (used only be JTATransaction).

Specified by:
getUserTransactionName in interface HibernateServiceMBean
Returns:
the JNDI name
See Also:
JTATransaction

setUserTransactionName

public void setUserTransactionName(String utName)
Description copied from interface: HibernateServiceMBean
Set the JNDI name of the JTA UserTransaction object (used only by JTATransaction).

Specified by:
setUserTransactionName in interface HibernateServiceMBean
Parameters:
utName - the JNDI name
See Also:
JTATransaction

getTransactionManagerLookupStrategy

public String getTransactionManagerLookupStrategy()
Description copied from interface: HibernateServiceMBean
Get the strategy for obtaining the JTA TransactionManager

Specified by:
getTransactionManagerLookupStrategy in interface HibernateServiceMBean
Returns:
the class name
See Also:
TransactionManagerLookup

setTransactionManagerLookupStrategy

public void setTransactionManagerLookupStrategy(String lkpStrategy)
Description copied from interface: HibernateServiceMBean
Set the strategy for obtaining the JTA TransactionManager

Specified by:
setTransactionManagerLookupStrategy in interface HibernateServiceMBean
Parameters:
lkpStrategy - the class name
See Also:
TransactionManagerLookup

getPropertyList

public String getPropertyList()
Description copied from interface: HibernateServiceMBean
Display the properties

Specified by:
getPropertyList in interface HibernateServiceMBean
Returns:
a list of property names and values

getProperty

public String getProperty(String property)
Description copied from interface: HibernateServiceMBean
Get a property

Specified by:
getProperty in interface HibernateServiceMBean
Parameters:
property - the property name
Returns:
the property value

setProperty

public void setProperty(String property,
                        String value)
Description copied from interface: HibernateServiceMBean
Set a property

Specified by:
setProperty in interface HibernateServiceMBean
Parameters:
property - the property name
value - the property value

dropSchema

public void dropSchema()
Description copied from interface: HibernateServiceMBean
Export the DROP DDL to the database

Specified by:
dropSchema in interface HibernateServiceMBean

createSchema

public void createSchema()
Description copied from interface: HibernateServiceMBean
Export the CREATE DDL to the database

Specified by:
createSchema in interface HibernateServiceMBean

getName

public String getName()

getDatasource

public String getDatasource()
Description copied from interface: HibernateServiceMBean
The JNDI name of the datasource to use in this SessionFactory

Specified by:
getDatasource in interface HibernateServiceMBean
Returns:
String

setDatasource

public void setDatasource(String datasource)
Description copied from interface: HibernateServiceMBean
Set the JNDI name of the datasource to use in this SessionFactory

Specified by:
setDatasource in interface HibernateServiceMBean
Parameters:
datasource -

getJndiName

public String getJndiName()
Description copied from interface: HibernateServiceMBean
The JNDI name to bind to the SessionFactory

Specified by:
getJndiName in interface HibernateServiceMBean
Returns:
String

setJndiName

public void setJndiName(String jndiName)
Description copied from interface: HibernateServiceMBean
The JNDI name to bind to the SessionFactory

Specified by:
setJndiName in interface HibernateServiceMBean
Parameters:
jndiName -

getUserName

public String getUserName()
Description copied from interface: HibernateServiceMBean
Log into the database with this name

Specified by:
getUserName in interface HibernateServiceMBean
Returns:
String

setUserName

public void setUserName(String userName)
Description copied from interface: HibernateServiceMBean
Log into the database with this name

Specified by:
setUserName in interface HibernateServiceMBean
Parameters:
userName -

getPassword

public String getPassword()
Description copied from interface: HibernateServiceMBean
Log into the database with this password

Specified by:
getPassword in interface HibernateServiceMBean
Returns:
String

setPassword

public void setPassword(String password)
Description copied from interface: HibernateServiceMBean
Log into the database with this password

Specified by:
setPassword in interface HibernateServiceMBean
Parameters:
password -

setFlushBeforeCompletionEnabled

public void setFlushBeforeCompletionEnabled(String enabled)
Description copied from interface: HibernateServiceMBean
Enable automatic flushing of the Session when JTA transaction ends.

Specified by:
setFlushBeforeCompletionEnabled in interface HibernateServiceMBean

getFlushBeforeCompletionEnabled

public String getFlushBeforeCompletionEnabled()
Description copied from interface: HibernateServiceMBean
Is automatic Session flusing enabled?

Specified by:
getFlushBeforeCompletionEnabled in interface HibernateServiceMBean

setAutoCloseSessionEnabled

public void setAutoCloseSessionEnabled(String enabled)
Description copied from interface: HibernateServiceMBean
Enable automatic closing of Session when JTA transaction ends.

Specified by:
setAutoCloseSessionEnabled in interface HibernateServiceMBean

getAutoCloseSessionEnabled

public String getAutoCloseSessionEnabled()
Description copied from interface: HibernateServiceMBean
Is automatic Session closing enabled?

Specified by:
getAutoCloseSessionEnabled in interface HibernateServiceMBean

getProperties

public Properties getProperties()