Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I specify a directory or directories of classes in hibernate.cfg.xml?

 
david zhang
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am learning Hibernate and JPA Annotation. The following is what I use to make Hibernate be aware of JPA-annotated classes:

......
config.addAnnotatedClass(Thing.class);
config.addAnnotatedClass(Fracture.class);
config.addAnnotatedClass(Interest.class);
config.addAnnotatedClass(Ancestor.class);
config.addAnnotatedClass(Parent.class);
......

It is very tedious to add every class like the above.

Is there any way I can use to specify all JPA-annotated classes in a directory or directories in Hibernate.cfg.xml?

Thanks for your help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic