2

I want to ask if there are any ways I can map multiple entities in the same package easier in the hibernate.cfg.xml file.

My hibernate.cfg.xml file looks like this:

<hibernate-configuration>
    <session-factory>
        .....

        <mapping class="com.mypackage.entity.MyEntity1"/>
        <mapping class="com.mypackage.entity.MyEntity2"/>
        <mapping class="com.mypackage.entity.MyEntity3"/>
        <mapping class="com.mypackage.entity.MyEntity4"/>
         .....
        <mapping class="com.mypackage.entity.MyEntity20"/>
    </session-factory>
</hibernate-configuration>

Is there anyway I can specify that all the classes in the com.mypackage.entity package should all be mapped as entity?

Many thanks

Kevin
  • 5,972
  • 17
  • 63
  • 87
  • check http://stackoverflow.com/questions/11257598/how-to-scan-packages-for-hibernate-entities-instead-of-using-hbm-xml – xp500 Feb 16 '14 at 21:01
  • possible duplicate http://stackoverflow.com/questions/1413190/hibernate-mapping-package – mikemil Feb 17 '14 at 03:38

0 Answers0