I'm trying to retrieve student details(i.e.display to Student's page) entered by admin. But by doing so, i'm facing an error which is

```
org.apache.jasper.JasperException: An exception occurred processing JSP page /StuGenInfo_Stu.jsp at line 122

119:        sessionn.beginTransaction();
120:        String enroll=Stu_Name.getEnroll();
121:        out.println(enroll);
122:        Query query=sessionn.createQuery("from StuAcadDetails where ENROLLMENT_NUMBER="+enroll );
123:        List<StuAcadDetails> detail=(List<StuAcadDetails>)query.list();
124:        
125:        for(StuAcadDetails stuDetails:detail)

Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
root cause

org.hibernate.hql.internal.ast.QuerySyntaxException: StuAcadDetails is not mapped [from StuAcadDetails where ENROLLMENT_NUMBER=NU/A9/45055]
    org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
    org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:110)
    org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:93)
    org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:324)
    org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3420)
    org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3309)
    org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:706)
    org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:562)
    org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299)
    org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247)
    org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:250)
    org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
    org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138)
    org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)
    org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
    org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)
    org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:222)
    org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:200)
    org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1703)
    org.apache.jsp.StuGenInfo_005fStu_jsp._jspService(StuGenInfo_005fStu_jsp.java:203)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.

Apache Tomcat/7.0.47

```

In my project, admin enters the student academics information and student has got the login id which is a Primary key named Enrollment\_Number. And as soon as student logs in student should be able to see all the info regarding its academics. 

I'm trying to achieve this by saving the enrollment into session(Saving in Login Page) and using this enrollment (Retrieving enrollment in StuGenInfo\_Stu.jsp Page) to fetch the respective record from MySql database.  

**Configuration File**

```
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" >
<hibernate-configuration>

  <session-factory>
    <!-- Database connection settings -->
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url">jdbc:mysql://localhost:3306/MBSIS</property>
    <property name="connection.username">root</property>
    <property name="connection.password">admin</property>

    <!-- JDBC connection pool (use the built-in) -->
    <property name="connection.pool_size">1</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

    <!-- Enable Hibernate's automatic session context management -->
    <property name="current_session_context_class">thread</property>

    <!-- Disable the second-level cache  -->
    <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>

    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>

    <!-- Drop and re-create the database schema on startup -->
    <property name="hbm2ddl.auto">update</property>
    <mapping class="org.faculty.entity.RegistrationFaculty"/>
    <mapping class="org.faculty.entity.StuAcadDetails"/>
  </session-factory>
</hibernate-configuration>

```

**StuAcadDetails**

```
@Table(name="ACADEMICS_DETAILS")
@Entity
public class StuAcadDetails {

    @Id
    @Column(name="ENROLLMENT_NUMBER")
    private String enroll;

    @Column(name="SEMESTER")
    private int semester;

    @Column(name="BRANCH")
    private String branch;

    @Temporal(TemporalType.DATE)
    @Column(name="DATE_OF_JOINING")
    private Date doj;

    @Column(name="ATTDCE_IN_THEORY")
    private int attThry;

    @Column(name="ATTDCE_IN_PRACTICAL")
    private int attPrac;

    @Column(name="PREVIOUS_SEM_PERCENTAGE")
    private float preSemPer;

    @Column(name="OVERALL_AGGREGATE")
    private float overallAggr;

    @Column(name="SESSIONAL_PERCENTAGE")
    private float sessPer;

    @Column(name="PERFORMANCE")
    private String performance;

    /*********************************************************************/
    public String getEnroll() {
        return enroll;
    }
    public void setEnroll(String enroll) {
        this.enroll = enroll;
    }
    public int getSemester() {
        return semester;
    }
    public void setSemester(int semester) {
        this.semester = semester;
    }
    public String getBranch() {
        return branch;
    }
    public void setBranch(String branch) {
        this.branch = branch;
    }
    public Date getDoj() {
        return doj;
    }
    public void setDoj(Date doj) {
        this.doj = doj;
    }
    public int getAttThry() {
        return attThry;
    }
    public void setAttThry(int attThry) {
        this.attThry = attThry;
    }
    public int getAttPrac() {
        return attPrac;
    }
    public void setAttPrac(int attPrac) {
        this.attPrac = attPrac;
    }
    public float getPreSemPer() {
        return preSemPer;
    }
    public void setPreSemPer(float preSemPer) {
        this.preSemPer = preSemPer;
    }
    public float getOverallAggr() {
        return overallAggr;
    }
    public void setOverallAggr(float overallAggr) {
        this.overallAggr = overallAggr;
    }
    public float getSessPer() {
        return sessPer;
    }
    public void setSessPer(float sessPer) {
        this.sessPer = sessPer;
    }
    public String getPerformance() {
        return performance;
    }
    public void setPerformance(String performance) {
        this.performance = performance;
    }   

}

```