- dylan_cherie
- 等级:
- 性别:
- 文章: 38
- 积分: 298
|
xml 代码
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="configurationClass">
- <value>org.hibernate.cfg.AnnotationConfiguration</value>
- </property>
- <property name="configLocation">
- <value>classpath:hibernate.cfg.xml</value>
- </property>
- </bean>
LocalSessionFactoryBean 中的原码注解:
private Class configurationClass = Configuration.class;
/**
* Specify the Hibernate Configuration class to use.
* Default is "org.hibernate.cfg.Configuration"; any subclass of
* this default Hibernate Configuration class can be specified.
*
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.
* @see #setConfigLocation
* @see org.hibernate.cfg.Configuration
* @see org.hibernate.cfg.AnnotationConfiguration
*/
public void setConfigurationClass(Class configurationClass) {
if (configurationClass == null || !Configuration.class.isAssignableFrom(configurationClass)) {
throw new IllegalArgumentException(
"configurationClass must be assignable to [org.hibernate.cfg.Configuration]");
}
this.configurationClass = configurationClass;
}
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
返回顶楼 |
|
|
- shaucle
- 等级:
- 性别:
- 文章: 435
- 积分: 443
- 来自: 上海
|
学习一下
|
返回顶楼 |
|
|
- daoger
- 等级:
- 性别:
- 文章: 992
- 积分: 914
- 来自: 山东济南
|
dylan_cherie 写道:
xml 代码
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="configurationClass">
- <value>org.hibernate.cfg.AnnotationConfigurationvalue>
- property>
- <property name="configLocation">
- <value>classpath:hibernate.cfg.xmlvalue>
- property>
- bean>
LocalSessionFactoryBean 中的原码注解:
private Class configurationClass = Configuration.class;
/**
* Specify the Hibernate Configuration class to use.
* Default is "org.hibernate.cfg.Configuration"; any subclass of
* this default Hibernate Configuration class can be specified.
*
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.
* @see #setConfigLocation
* @see org.hibernate.cfg.Configuration
* @see org.hibernate.cfg.AnnotationConfiguration
*/
public void setConfigurationClass(Class configurationClass) {
if (configurationClass == null || !Configuration.class.isAssignableFrom(configurationClass)) {
throw new IllegalArgumentException(
"configurationClass must be assignable to [org.hibernate.cfg.Configuration]");
}
this.configurationClass = configurationClass;
}
没弄懂lz要干什么!
|
返回顶楼 |
|
|
- ahuaxuan
- 等级:
- 性别:
- 文章: 838
- 积分: 2656
- 来自: 杭州
|
lz说话相当的言简意赅,我也是没有弄懂楼主的目的,楼主能否更详细点来描述一下:你要做什么,怎么做,为什么要这么做?
|
返回顶楼 |
|
|
- 温柔一刀
- 等级:
- 性别:
- 文章: 801
- 积分: 1192
- 来自: 上海
|
楼主估计是想说Spring下使用Hibenrate annotation时sessionFactory的配置
|
返回顶楼 |
|
|
- dylan_cherie
- 等级:
- 性别:
- 文章: 38
- 积分: 298
|
不好意思没说明白,此文讲的是Hibenrate annotation在spring中使用的配置方法。
|
返回顶楼 |
|
|