directory « cfg « JPA Q&A





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

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 ...

2. How to map a directory and not concrete cfg.xml file.    forum.hibernate.org

Hi again, I have a configuration xml file, from which my SessionFactory is configured. I need something like: but to map a directory not a concrete file. With java code it is possible, but I want to know, if this is possible in xml configuration file, because I don't want to spread configuration all over the code, but to ...