|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.orm.hibernate3.AbstractSessionFactoryBean org.springframework.orm.hibernate3.LocalSessionFactoryBean org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
public class AnnotationSessionFactoryBean
Subclass of Spring's standard LocalSessionFactoryBean for Hibernate3, supporting JDK 1.5+ annotation metadata for mappings. Requires the Hibernate3 Annotation add-on to be present.
Example bean definition:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="annotatedClasses"> <list> <value>test.package.Foo</value> <value>test.package.Bar</value> </list> </property> <property name="annotatedPackages"> <list> <value>test.package</value> </list> </property> </bean>
AbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)
,
LocalSessionFactoryBean.setHibernateProperties(java.util.Properties)
,
setAnnotatedClasses(java.lang.Class[])
,
setAnnotatedPackages(java.lang.String[])
Field Summary |
---|
Fields inherited from class org.springframework.orm.hibernate3.AbstractSessionFactoryBean |
---|
logger |
Constructor Summary | |
---|---|
AnnotationSessionFactoryBean()
|
Method Summary | |
---|---|
protected void |
postProcessAnnotationConfiguration(AnnotationConfiguration config)
To be implemented by subclasses that want to to perform custom post-processing of the AnnotationConfiguration object after this FactoryBean performed its default initialization. |
protected void |
postProcessConfiguration(Configuration config)
Reads metadata from annotated classes and packages into the AnnotationConfiguration instance. |
void |
setAnnotatedClasses(Class[] annotatedClasses)
Specify annotated classes, for which mappings will be read from class-level JDK 1.5+ annotation metadata. |
void |
setAnnotatedPackages(String[] annotatedPackages)
Specify the names of annotated packages, for which package-level JDK 1.5+ annotation metadata will be read. |
void |
setConfigurationClass(Class configurationClass)
Specify the Hibernate Configuration class to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationSessionFactoryBean()
Method Detail |
---|
public void setConfigurationClass(Class configurationClass)
LocalSessionFactoryBean
Can be set to "org.hibernate.cfg.AnnotationConfiguration" for using Hibernate3 annotation support (initially only available as alpha download separate from the main Hibernate3 distribution).
Annotated packages and annotated classes can be specified via the corresponding tags in "hibernate.cfg.xml" then, so this will usually be combined with a "configLocation" property that points at such a standard Hibernate configuration file.
setConfigurationClass
in class LocalSessionFactoryBean
public void setAnnotatedClasses(Class[] annotatedClasses)
public void setAnnotatedPackages(String[] annotatedPackages)
protected final void postProcessConfiguration(Configuration config) throws HibernateException
Calls postProcessAnnotationConfiguration
afterwards,
to give subclasses the chance to perform custom post-processing.
postProcessConfiguration
in class LocalSessionFactoryBean
config
- the current Configuration object
HibernateException
- in case of Hibernate initialization errorspostProcessAnnotationConfiguration(org.hibernate.cfg.AnnotationConfiguration)
protected void postProcessAnnotationConfiguration(AnnotationConfiguration config) throws HibernateException
config
- the current AnnotationConfiguration object
HibernateException
- in case of Hibernate initialization errors
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |