@Deprecated public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implements ResourceLoaderAware
Example for an AnnotationSessionFactoryBean bean definition:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="annotatedClasses"> <list> <value>test.package.Foo</value> <value>test.package.Bar</value> </list> </property> </bean>Or when using classpath scanning for autodetection of entity classes:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="packagesToScan" value="test.package"/> </bean>
Requires Hibernate 3.6.x, as of Spring 4.0.
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<?>[] |
annotatedClasses
Deprecated.
|
private java.lang.String[] |
annotatedPackages
Deprecated.
|
private TypeFilter[] |
entityTypeFilters
Deprecated.
|
private static java.lang.String |
PACKAGE_INFO_SUFFIX
Deprecated.
|
private java.lang.String[] |
packagesToScan
Deprecated.
|
private static java.lang.String |
RESOURCE_PATTERN
Deprecated.
|
private ResourcePatternResolver |
resourcePatternResolver
Deprecated.
|
logger
Constructor and Description |
---|
AnnotationSessionFactoryBean()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
matchesEntityTypeFilter(MetadataReader reader,
MetadataReaderFactory readerFactory)
Deprecated.
Check whether any of the configured entity type filters matches
the current class descriptor contained in the metadata reader.
|
protected void |
postProcessMappings(Configuration config)
Deprecated.
Reads metadata from annotated classes and packages into the
AnnotationConfiguration instance.
|
protected void |
scanPackages(Configuration config)
Deprecated.
Perform Spring-based scanning for entity classes.
|
void |
setAnnotatedClasses(java.lang.Class<?>... annotatedClasses)
Deprecated.
Specify annotated classes, for which mappings will be read from
class-level annotation metadata.
|
void |
setAnnotatedPackages(java.lang.String... annotatedPackages)
Deprecated.
Specify the names of annotated packages, for which package-level
annotation metadata will be read.
|
void |
setEntityTypeFilters(TypeFilter... entityTypeFilters)
Deprecated.
Specify custom type filters for Spring-based scanning for entity classes.
|
void |
setPackagesToScan(java.lang.String... packagesToScan)
Deprecated.
Specify packages to search using Spring-based scanning for entity classes in
the classpath.
|
void |
setResourceLoader(ResourceLoader resourceLoader)
Deprecated.
Set the ResourceLoader that this object runs in.
|
afterSessionFactoryCreation, buildSessionFactory, createDatabaseSchema, destroy, dropDatabaseSchema, executeSchemaScript, executeSchemaStatement, getConfigTimeDataSource, getConfigTimeLobHandler, getConfigTimeTransactionManager, getConfiguration, getHibernateProperties, newConfiguration, newSessionFactory, postProcessConfiguration, setBeanClassLoader, setCacheableMappingLocations, setCacheRegionFactory, setCollectionCacheStrategies, setConfigLocation, setConfigLocations, setConfigurationClass, setEntityCacheStrategies, setEntityInterceptor, setEventListeners, setFilterDefinitions, setHibernateProperties, setJtaTransactionManager, setLobHandler, setMappingDirectoryLocations, setMappingJarLocations, setMappingLocations, setMappingResources, setNamingStrategy, setSchemaUpdate, setTypeDefinitions, updateDatabaseSchema, validateDatabaseSchema
afterPropertiesSet, beforeSessionFactoryDestruction, getDataSource, getObject, getObjectType, getSessionFactory, isExposeTransactionAwareSessionFactory, isSingleton, isUseTransactionAwareDataSource, setDataSource, setExposeTransactionAwareSessionFactory, setUseTransactionAwareDataSource, wrapSessionFactoryIfNecessary
convertHibernateAccessException, setJdbcExceptionTranslator, translateExceptionIfPossible
private static final java.lang.String RESOURCE_PATTERN
private static final java.lang.String PACKAGE_INFO_SUFFIX
private java.lang.Class<?>[] annotatedClasses
private java.lang.String[] annotatedPackages
private java.lang.String[] packagesToScan
private TypeFilter[] entityTypeFilters
private ResourcePatternResolver resourcePatternResolver
public void setAnnotatedClasses(java.lang.Class<?>... annotatedClasses)
org.hibernate.cfg.Configuration#addAnnotatedClass(Class)
public void setAnnotatedPackages(java.lang.String... annotatedPackages)
org.hibernate.cfg.Configuration#addPackage(String)
public void setPackagesToScan(java.lang.String... packagesToScan)
Default is none. Specify packages to search for autodetection of your entity
classes in the classpath. This is analogous to Spring's component-scan feature
(ClassPathBeanDefinitionScanner
).
public void setEntityTypeFilters(TypeFilter... entityTypeFilters)
Default is to search all specified packages for classes annotated with
@javax.persistence.Entity
, @javax.persistence.Embeddable
or @javax.persistence.MappedSuperclass
, as well as for
Hibernate's special @org.hibernate.annotations.Entity
.
setPackagesToScan(java.lang.String...)
public void setResourceLoader(ResourceLoader resourceLoader)
ResourceLoaderAware
This might be a ResourcePatternResolver, which can be checked
through instanceof ResourcePatternResolver
. See also the
ResourcePatternUtils.getResourcePatternResolver
method.
Invoked after population of normal bean properties but before an init callback
like InitializingBean's afterPropertiesSet
or a custom init-method.
Invoked before ApplicationContextAware's setApplicationContext
.
setResourceLoader
in interface ResourceLoaderAware
resourceLoader
- the ResourceLoader object to be used by this objectResourcePatternResolver
,
ResourcePatternUtils.getResourcePatternResolver(org.springframework.core.io.ResourceLoader)
protected void postProcessMappings(Configuration config) throws HibernateException
postProcessMappings
in class LocalSessionFactoryBean
config
- the current Configuration objectHibernateException
- in case of Hibernate initialization errorsorg.hibernate.cfg.Configuration#buildMappings()
protected void scanPackages(Configuration config)
setPackagesToScan(java.lang.String...)
private boolean matchesEntityTypeFilter(MetadataReader reader, MetadataReaderFactory readerFactory) throws java.io.IOException
java.io.IOException