br.com.arsmachina.dao.hibernate.ioc
Class PersistenceConfiguration

java.lang.Object
  extended by br.com.arsmachina.dao.hibernate.ioc.PersistenceConfiguration

public class PersistenceConfiguration
extends Object

Class that configures the persistence layer for Spring. Database info is read from a datasource.properties file in the root of the classpath. Hibernate configuration properties is read from a hibernate.cfg.xml file, also in the root of the classpath.

Author:
Thiago H. de Paula Figueiredo

Field Summary
static String DATABASE_PASSWORD
          Property used to define the database user password.
static String DATABASE_URL
          Property used to define the database url.
static String DATABASE_USERNAME
          Property used to define the database user name.
static String HIBERNATE_CONFIGURATION_FILE
          Location, in the classpath, of the Hibernate configuration file.
static String JDBC_DRIVER
          Property used to define the database JDBC driver class name.
 
Constructor Summary
PersistenceConfiguration()
          Single constructor of this class.
 
Method Summary
 DataSource dataSource()
          Creates a DataSource.
 String getDatabasePassword()
          Returns the database user password.
 String getDatabaseURL()
          Returns the JDBC driver class name.
 String getDatabaseUsername()
          Returns the database user name.
 String getJDBCDriver()
          Returns the JDBC driver class name.
 org.hibernate.SessionFactory sessionFactory()
          Creates a SessionFactory that uses annotations and/or XML for mapping classes.
 org.springframework.transaction.PlatformTransactionManager transactionManager()
          Creates the PlatformTransactionManager to be used by Spring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIBERNATE_CONFIGURATION_FILE

public static final String HIBERNATE_CONFIGURATION_FILE
Location, in the classpath, of the Hibernate configuration file.

See Also:
Constant Field Values

DATABASE_URL

public static final String DATABASE_URL
Property used to define the database url.

See Also:
Constant Field Values

JDBC_DRIVER

public static final String JDBC_DRIVER
Property used to define the database JDBC driver class name.

See Also:
Constant Field Values

DATABASE_USERNAME

public static final String DATABASE_USERNAME
Property used to define the database user name.

See Also:
Constant Field Values

DATABASE_PASSWORD

public static final String DATABASE_PASSWORD
Property used to define the database user password.

See Also:
Constant Field Values
Constructor Detail

PersistenceConfiguration

public PersistenceConfiguration()
Single constructor of this class.

Method Detail

dataSource

public DataSource dataSource()
Creates a DataSource.

Returns:
a DataSource.

sessionFactory

public org.hibernate.SessionFactory sessionFactory()
Creates a SessionFactory that uses annotations and/or XML for mapping classes.

Returns:
a SessionFactory.

transactionManager

public org.springframework.transaction.PlatformTransactionManager transactionManager()
Creates the PlatformTransactionManager to be used by Spring.

Returns:
a HibernateTransactionManager.

getDatabaseURL

public String getDatabaseURL()
Returns the JDBC driver class name.

Returns:
a String.

getJDBCDriver

public String getJDBCDriver()
Returns the JDBC driver class name.

Returns:
a String.

getDatabaseUsername

public String getDatabaseUsername()
Returns the database user name.

Returns:
a String.

getDatabasePassword

public String getDatabasePassword()
Returns the database user password.

Returns:
a String.


Copyright © 2008-2009 Thiago H. de Paula Figueiredo. All Rights Reserved.