hibernate annotations跟hbm.xml配置文件并存配置
hibernate annotations和hbm.xml配置文件并存配置
hibernate annotations和hbm.xml配置文件并存配置
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="current_session_context_class">thread</prop> <!-- <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> --> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">none</prop> <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop> </props> </property> <property name="packagesToScan" value="com.*.dao.pojo.*" /> <property name="mappingResources"> <list> <!-- <value>com/*/*/User.hbm.xml</value> --> </list> </property> </bean>
1 楼
wangluo19
2012-08-15
刚刚好解决了我的问题,原来session factory可以把hbm.xml文件也一起读进来~~~