0

1.I add below line in hibernate.cfg.xml but it doesn't works.
2.If i put classes in mapping, everything works.Does any one use this type of configuration ?

    <mapping package="com.common"/>
Mahesh
  • 248
  • 4
  • 19
  • You cannot map using package, but there is a work around http://stackoverflow.com/questions/1413190/hibernate-mapping-package?rq=1 – Zeus Feb 16 '14 at 03:53
  • Thanks 4 your answer but i don't want to write code. I thought hibernate may provide something 4 this. – Mahesh Feb 17 '14 at 14:01
  • Did you check the last answer given in the link above? it had 6 votes on it. – Zeus Feb 17 '14 at 14:54

1 Answers1

1

I added below configuration

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="com.common.domainobjects" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">create</prop>
        </props>
    </property>
</bean>
Mahesh
  • 248
  • 4
  • 19