1) Bean Class
org.springframework.orm.hibernate4.LocalSessionFactoryBean.LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean();
localSessionFactoryBean.setConfigLocations( my hibernate.cfg.xml);
localSessionFactoryBean.afterPropertiesSet();
2) hibernate-cfg.xml
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">none</property>
<property name="jdbc.batch_size">20</property>
<property name="hibernate.connection.datasource">myDataSource</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<mapping resource="MappingFile.hbm.xml" />
3) MappingFile.hbm.xml
<hibernate-mapping package="com.xyz">
<class entity-name="EntityName" table="TABLE1">
<id name="id" type="integer" column="ID">
<generator class="org.hibernate.id.TableHiLoGenerator">
</generator>
</id>
<component name="compName" class="com.abc">
</component>
<class>
</hibernate-mapping>
It works fine with hibernate 3.5.6-Final and Spring 3.0 but with hibernate 4.1.6.Final and Spring 3.1.3.RELEASE I get following error, when we call afterPropertiesSet method on LocalSessionFactoryBean.
org.hibernate.MappingException : component class not found : com.abc
|