Hello, I've used Hibernate Plugin of Hibernate Tools Package. I've generated all correctly, but in main process:
Main.java
Code:
package com.gmsoft;
import com.gmsoft.model.Role;
import com.gmsoft.model.RoleHome;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
com.gmsoft.model.Role rol = new Role(60,"Hibernate");
com.gmsoft.model.RoleHome rolDAO = new RoleHome();
rolDAO.persist(rol);
}
}
Quote:
17-oct-2006 17:29:07 com.gmsoft.model.RoleHome getSessionFactory
GRAVE: Could not locate SessionFactory in JNDI
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.gmsoft.model.RoleHome.getSessionFactory(RoleHome.java:27)
at com.gmsoft.model.RoleHome.<init>(RoleHome.java:22)
at com.gmsoft.Main.main(Main.java:14)
Exception in thread "main" java.lang.IllegalStateException: Could not locate SessionFactory in JNDI
at com.gmsoft.model.RoleHome.getSessionFactory(RoleHome.java:30)
at com.gmsoft.model.RoleHome.<init>(RoleHome.java:22)
at com.gmsoft.Main.main(Main.java:14)
Can you help me, please?
Thanks in advance.