<bean id="comLog4ceSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="comLog4ceDataSource" />
<property name="annotatedClasses">
<list>
<value>com.ce.component.log4ce.core.BizLogInfo</value>
</list>
</property>
<property name="annotatedPackages">
<list>
<value>com.ce.component.log4ce.core</value>
</list>
</property>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration">
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${log4cehibernate.dialect}</prop>
<prop key="hibernate.show_sql">${log4cehibernate.show_sql}</prop>
<prop key="hibernate.connection.release_mode">${log4cehibernate.connection.release_mode}</prop>
<prop key="hibernate.hbm2ddl.auto">${log4cehibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.jdbc.fetch_size">${log4cehibernate.jdbc.fetch_size}</prop>
<prop key="hibernate.jdbc.batch_size">${log4cehibernate.jdbc.batch_size}</prop>
<prop key="hibernate.connection.charSet">${log4cehibernate.connection.charSet}</prop>
</props>
</property>
</bean>
中的
<property name="annotatedPackages">
<list>
<value>com.ce.component.log4ce.core</value>
</list>
</property>表示com.ce.component.log4ce.core包以下的所有类都要有Annotation,如果有的类没有就Tomcat启动时候暴Warn:
2008-09-01 15:06:09,807 WARN [org.hibernate.cfg.AnnotationBinder] - <Package not found or wo package-info.java: com.ce.component.log4ce.core>
<property name="dataSource" ref="comLog4ceDataSource" />
<property name="annotatedClasses">
<list>
<value>com.ce.component.log4ce.core.BizLogInfo</value>
</list>
</property>
<property name="annotatedPackages">
<list>
<value>com.ce.component.log4ce.core</value>
</list>
</property>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration">
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${log4cehibernate.dialect}</prop>
<prop key="hibernate.show_sql">${log4cehibernate.show_sql}</prop>
<prop key="hibernate.connection.release_mode">${log4cehibernate.connection.release_mode}</prop>
<prop key="hibernate.hbm2ddl.auto">${log4cehibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.jdbc.fetch_size">${log4cehibernate.jdbc.fetch_size}</prop>
<prop key="hibernate.jdbc.batch_size">${log4cehibernate.jdbc.batch_size}</prop>
<prop key="hibernate.connection.charSet">${log4cehibernate.connection.charSet}</prop>
</props>
</property>
</bean>
中的
<property name="annotatedPackages">
<list>
<value>com.ce.component.log4ce.core</value>
</list>
</property>表示com.ce.component.log4ce.core包以下的所有类都要有Annotation,如果有的类没有就Tomcat启动时候暴Warn:
2008-09-01 15:06:09,807 WARN [org.hibernate.cfg.AnnotationBinder] - <Package not found or wo package-info.java: com.ce.component.log4ce.core>