on 04-05-2006 2:22 PM
Hi,
I have written one ejb project with hibernate in my net weaver.Now i have a problem in placing hibernate.cfg.xml.so tell me where to place it .Give some examples related to that and some related links.
Hi,
you can place it into the root of the EJB project as your EJBs probably access Hibernate as persistence layer. In this case make sure that you pass the string "hibernate.cfg.xml" within the method invocation when retrieving a SessionFactory as follows:
try
{
Configuration cfg = new Configuration();
sessionFactory = cfg.configure
("hibernate.cfg.xml").buildSessionFactory();
}
catch (Throwable ex)
{
...
}
Otherwise the Configuration file may not be found by the application class loader due to different path syntax.
For further information you can refer to this https://www.sdn.sap.com/irj/sdn/developerareas/java?rid=/webcontent/uuid/e081a4b6-0801-0010-7fa4-c3c... [original link is broken] [original link is broken], although the hibernate.cfg.xml file is placed in the Web-Project in this example.
Hope this helps,
Best regards,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.