|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hibernate.cfg.Configuration
org.springframework.orm.hibernate4.LocalSessionFactoryBuilder
public class LocalSessionFactoryBuilder
A Spring-provided extension of the standard Hibernate Configuration class,
adding SpringSessionContext as a default and providing convenient ways
to specify a DataSource and an application class loader.
This is designed for programmatic use, e.g. in @Bean factory methods.
Consider using LocalSessionFactoryBean for XML bean definition files.
LocalSessionFactoryBean,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.hibernate.cfg.Configuration |
|---|
Configuration.MappingsImpl, Configuration.MetadataSourceQueue |
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
LocalSessionFactoryBuilder(DataSource dataSource)
Create a new LocalSessionFactoryBuilder for the given DataSource. |
|
LocalSessionFactoryBuilder(DataSource dataSource,
ClassLoader classLoader)
Create a new LocalSessionFactoryBuilder for the given DataSource. |
|
LocalSessionFactoryBuilder(DataSource dataSource,
ResourceLoader resourceLoader)
Create a new LocalSessionFactoryBuilder for the given DataSource. |
|
| Method Summary | |
|---|---|
LocalSessionFactoryBuilder |
addAnnotatedClasses(Class<?>... annotatedClasses)
Add the given annotated classes in a batch. |
LocalSessionFactoryBuilder |
addPackages(String... annotatedPackages)
Add the given annotated packages in a batch. |
SessionFactory |
buildSessionFactory()
Build the SessionFactory. |
LocalSessionFactoryBuilder |
scanPackages(String... packagesToScan)
Perform Spring-based scanning for entity classes, registering them as annotated classes with this Configuration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LocalSessionFactoryBuilder(DataSource dataSource)
dataSource - the JDBC DataSource that the resulting Hibernate SessionFactory should be using
(may be null)
public LocalSessionFactoryBuilder(DataSource dataSource,
ClassLoader classLoader)
dataSource - the JDBC DataSource that the resulting Hibernate SessionFactory should be using
(may be null)classLoader - the ClassLoader to load application classes from
public LocalSessionFactoryBuilder(DataSource dataSource,
ResourceLoader resourceLoader)
dataSource - the JDBC DataSource that the resulting Hibernate SessionFactory should be using
(may be null)classLoader - the ResourceLoader to load application classes from| Method Detail |
|---|
public LocalSessionFactoryBuilder addAnnotatedClasses(Class<?>... annotatedClasses)
Configuration.addAnnotatedClass(java.lang.Class),
scanPackages(java.lang.String...)public LocalSessionFactoryBuilder addPackages(String... annotatedPackages)
Configuration.addPackage(java.lang.String),
scanPackages(java.lang.String...)
public LocalSessionFactoryBuilder scanPackages(String... packagesToScan)
throws HibernateException
Configuration.
packagesToScan - one or more Java package names
HibernateException - if scanning fails for any reason
public SessionFactory buildSessionFactory()
throws HibernateException
SessionFactory.
buildSessionFactory in class ConfigurationHibernateException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||