I'm using Hibernate Annotations.
In all my model classes I annotate like this:
@Entity
@Table
public class SomeModelClass {
//
}
My hibernate.cfg.xml is
<hibernate-configuration>
<session-factory>
<!-- some properties -->
<mapping package="com.fooPackage" />
<mapping class="com.fooPackage.SomeModelClass" />
</session-factory>
</hibernate-configuration>
For every class I add to the com.fooPackage I have to add a line in the hibernate.cfg.xml like this:
<mapping class="com.fooPackage.AnotherModelClass" />
Is there a way I can add new model classes but don't need to add this line to hibernate.cfg.xml?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…