Note that there are some explanatory texts on larger screens.

plurals
  1. POStruts2: unable to load HibernateSessionFactory.getSession() in DAO class
    primarykey
    data
    text
    <p>I am running an application on JBoss server which is developed using struts2 &amp; Hibernate. But I am facing a problem in my getEmployee method of LoginDAOImpl class.The code is as below:-</p> <pre><code>@SuppressWarnings("unchecked") public List&lt;UserView&gt; getEmployee(String empId) { Session session = null; List&lt;UserView&gt; list = null; try { System.out.println("in LoginDAOImpl getEmployee : 1 "); session = HibernateSessionFactory.getSession(); System.out.println("in LoginDAOImpl getEmployee : 2 " + session); String str = "from UserView where empId='" + empId + "'"; list = session.createQuery(str).list(); System.out.println("LoginDAOImpl.getEmployee()::" + empId); } catch (HibernateException e) { e.printStackTrace(); } finally { HibernateSessionFactory.closeSession(); } return list; } </code></pre> <p>Config file is below:-</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;!-- Generated by MyEclipse Hibernate Tools.--&gt; &lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="connection.username"&gt;root&lt;/property&gt; &lt;property name="dialect"&gt; org.hibernate.dialect.MySQLDialect &lt;/property&gt; &lt;property name="connection.password"&gt;root&lt;/property&gt; &lt;property name="connection.url"&gt; jdbc:mysql://192.168.1.90:3307/esupport &lt;/property&gt; &lt;property name="connection.driver_class"&gt; com.mysql.jdbc.Driver &lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;mapping class="com.Allied.dto.ActionView" /&gt; &lt;mapping class="com.Allied.dto.LeaveDto" /&gt; &lt;mapping class="com.Allied.dto.LeaveTypeDto" /&gt; &lt;mapping class="com.Allied.dto.RoleActionMap" /&gt; &lt;mapping class="com.Allied.dto.RoleView" /&gt; &lt;mapping class="com.Allied.dto.TimesheetTask" /&gt; &lt;mapping class="com.Allied.dto.UserRoleMap" /&gt; &lt;mapping class="com.Allied.dto.UserView" /&gt; &lt;mapping class="com.Allied.dto.EmployeeDetailsDto" /&gt; &lt;mapping class="com.Allied.dto.EmployeeLeave" /&gt; &lt;mapping class="com.Allied.dto.ItdfDetails" /&gt; &lt;mapping class="com.Allied.dto.Project" /&gt; &lt;mapping class="com.Allied.dto.EmployeeER" /&gt; &lt;mapping class="com.Allied.dto.EmployeeTimesheet" /&gt; &lt;mapping class="com.Allied.dto.ExpenseReportDto" /&gt; &lt;mapping class="com.Allied.dto.TRStatusDto" /&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; On Console Iam getting "in LoginDAOImpl getEmployee : 1 " but i am not getting "in LoginDAOImpl getEmployee : 2 ".That means it is not able to find Hibernatesessionfactory class.But I have included Hibernatesessionfactory in my path. I have included jars for Hibernate :- hibernate3.jar,hibernate-annotations-3.2.1.ga.jar,hibernate-annotations.jar,hibernate-commons-annotations.jar,hibernate-entitymanager.jar,hibernate-valid </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload