net.sf.hibernate.jmx
Class HibernateService

java.lang.Object
  extended bynet.sf.hibernate.jmx.HibernateService
All Implemented Interfaces:
HibernateServiceMBean

public class HibernateService
extends Object
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
See Also:
HibernateServiceMBean, SessionFactory

Constructor Summary
HibernateService()
           
 
Method Summary
 void addMapResource(String mapResource)
          Add a mapping file
protected  boolean getBooleanProperty(String propName)
           
 String getCacheProvider()
          Get the cache provider class
 String getDatasource()
          The JNDI name of the datasource to use in this SessionFactory
 String getDefaultSchema()
          Get the default schema name
 String getDialect()
          The JNDI name of the dialect class to use in this SessionFactory
protected  Integer getIntegerProperty(String propName)
           
 Integer getJdbcBatchSize()
          Get the JDBC batch size
 Integer getJdbcFetchSize()
          Get the JDBC fetch size
 String getJndiName()
          The JNDI name to bind to the SessionFactory
 String getMapResources()
          The Hibernate mapping files (might be overridden by subclasses that want to specify the mapping files by some other mechanism)
 Integer getMaxFetchDepth()
          Get the max outer join fetch depth
 String getName()
          The name of the current bean
 String getPassword()
          Log into the database with this password
protected  Properties getProperties()
           
 String getProperty(String property)
          Get a property
 String getPropertyList()
          Display the properties
 String getQuerySubstitutions()
          Get the query substitutions string
 boolean getShowSql()
          Is SQL logging enabled?
 String getTransactionManagerLookupStrategy()
          Get the strategy for obtaining the JTA TransactionManager
 String getTransactionStrategy()
          The fully qualified class name of the Hibernate TransactionFactory implementation
 boolean getUseOuterJoin()
          Is outerjoin fetching enabled?
 boolean getUseQueryCache()
          Is the query cache enabled?
 String getUserName()
          Log into the database with this name
 String getUserTransactionName()
          The JNDI name of the JTA UserTransaction object (used only be JTATransaction).
 void setCacheProvider(String cacheProvider)
          Set the cache provider class
 void setDatasource(String datasource)
          Set the JNDI name of the datasource to use in this SessionFactory
 void setDefaultSchema(String schema)
          Set the default schema name
 void setDialect(String dialect)
          The name of the dialect class to use in this SessionFactory
 void setJdbcBatchSize(Integer depth)
          Set the JDBC batch size
 void setJdbcFetchSize(Integer depth)
          Set the JDBC fetch size
 void setJndiName(String jndiName)
          The JNDI name to bind to the SessionFactory
 void setMapResources(String mapResources)
          Specify the Hibernate mapping files
 void setMaxFetchDepth(Integer depth)
          Set the max outer join fetch depth
 void setPassword(String password)
          Log into the database with this password
protected  void setProperty(String propName, boolean value)
           
protected  void setProperty(String propName, Integer value)
           
 void setProperty(String property, String value)
          Set a property
 void setQuerySubstitutions(String substitutions)
          Set the query substitutions string
 void setShowSql(boolean showSql)
          Enable logging of SQL to console
 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 setUseOuterJoin(boolean uoj)
          Enable outerjoin fetching
 void setUseQueryCache(boolean enabled)
          Enable/disable the query cache
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateService

public HibernateService()
Method Detail

getName

public String getName()
The name of the current bean

Returns:
String

getMapResources

public String getMapResources()
Description copied from interface: HibernateServiceMBean
The Hibernate mapping files (might be overridden by subclasses that want to specify the mapping files by some other mechanism)

Specified by:
getMapResources in interface HibernateServiceMBean
Returns:
String

setMapResources

public void setMapResources(String mapResources)
Description copied from interface: HibernateServiceMBean
Specify the Hibernate mapping files

Specified by:
setMapResources in interface HibernateServiceMBean
Parameters:
mapResources -

addMapResource

public void addMapResource(String mapResource)
Description copied from interface: HibernateServiceMBean
Add a mapping file

Specified by:
addMapResource in interface HibernateServiceMBean
Parameters:
mapResource -

getBooleanProperty

protected boolean getBooleanProperty(String propName)

setProperty

protected void setProperty(String propName,
                           boolean value)

setProperty

protected void setProperty(String propName,
                           Integer value)

getIntegerProperty

protected Integer getIntegerProperty(String propName)

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 -

getDialect

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

Specified by:
getDialect in interface HibernateServiceMBean
Returns:
String

setDialect

public void setDialect(String dialect)
Description copied from interface: HibernateServiceMBean
The name of the dialect class to use in this SessionFactory

Specified by:
setDialect in interface HibernateServiceMBean
Parameters:
dialect - fully qualified class name of Dialect subclass
See Also:
Dialect

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 -

getUseOuterJoin

public boolean getUseOuterJoin()
Description copied from interface: HibernateServiceMBean
Is outerjoin fetching enabled?

Specified by:
getUseOuterJoin in interface HibernateServiceMBean
Returns:
boolean

setUseOuterJoin

public void setUseOuterJoin(boolean uoj)
Description copied from interface: HibernateServiceMBean
Enable outerjoin fetching

Specified by:
setUseOuterJoin in interface HibernateServiceMBean
Parameters:
uoj -

getShowSql

public boolean getShowSql()
Description copied from interface: HibernateServiceMBean
Is SQL logging enabled?

Specified by:
getShowSql in interface HibernateServiceMBean
Returns:
boolean

setShowSql

public void setShowSql(boolean showSql)
Description copied from interface: HibernateServiceMBean
Enable logging of SQL to console

Specified by:
setShowSql in interface HibernateServiceMBean
Parameters:
showSql -

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 -

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

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

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

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

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

getProperties

protected Properties getProperties()

getCacheProvider

public String getCacheProvider()
Description copied from interface: HibernateServiceMBean
Get the cache provider class

Specified by:
getCacheProvider in interface HibernateServiceMBean

getDefaultSchema

public String getDefaultSchema()
Description copied from interface: HibernateServiceMBean
Get the default schema name

Specified by:
getDefaultSchema in interface HibernateServiceMBean

getJdbcBatchSize

public Integer getJdbcBatchSize()
Description copied from interface: HibernateServiceMBean
Get the JDBC batch size

Specified by:
getJdbcBatchSize in interface HibernateServiceMBean

getJdbcFetchSize

public Integer getJdbcFetchSize()
Description copied from interface: HibernateServiceMBean
Get the JDBC fetch size

Specified by:
getJdbcFetchSize in interface HibernateServiceMBean

getMaxFetchDepth

public Integer getMaxFetchDepth()
Description copied from interface: HibernateServiceMBean
Get the max outer join fetch depth

Specified by:
getMaxFetchDepth in interface HibernateServiceMBean

getUseQueryCache

public boolean getUseQueryCache()
Description copied from interface: HibernateServiceMBean
Is the query cache enabled?

Specified by:
getUseQueryCache in interface HibernateServiceMBean

getQuerySubstitutions

public String getQuerySubstitutions()
Description copied from interface: HibernateServiceMBean
Get the query substitutions string

Specified by:
getQuerySubstitutions in interface HibernateServiceMBean

setCacheProvider

public void setCacheProvider(String cacheProvider)
Description copied from interface: HibernateServiceMBean
Set the cache provider class

Specified by:
setCacheProvider in interface HibernateServiceMBean

setDefaultSchema

public void setDefaultSchema(String schema)
Description copied from interface: HibernateServiceMBean
Set the default schema name

Specified by:
setDefaultSchema in interface HibernateServiceMBean

setJdbcBatchSize

public void setJdbcBatchSize(Integer depth)
Description copied from interface: HibernateServiceMBean
Set the JDBC batch size

Specified by:
setJdbcBatchSize in interface HibernateServiceMBean

setJdbcFetchSize

public void setJdbcFetchSize(Integer depth)
Description copied from interface: HibernateServiceMBean
Set the JDBC fetch size

Specified by:
setJdbcFetchSize in interface HibernateServiceMBean

setMaxFetchDepth

public void setMaxFetchDepth(Integer depth)
Description copied from interface: HibernateServiceMBean
Set the max outer join fetch depth

Specified by:
setMaxFetchDepth in interface HibernateServiceMBean

setUseQueryCache

public void setUseQueryCache(boolean enabled)
Description copied from interface: HibernateServiceMBean
Enable/disable the query cache

Specified by:
setUseQueryCache in interface HibernateServiceMBean

setQuerySubstitutions

public void setQuerySubstitutions(String substitutions)
Description copied from interface: HibernateServiceMBean
Set the query substitutions string

Specified by:
setQuerySubstitutions in interface HibernateServiceMBean