title: Error:org.hibernate.hql.internal.ast.QuerySyntaxException: Website is not mapped
body: <p>I am trying to create project with restful web services.I am getting an error </p>
  
  <blockquote>
    <p>org.hibernate.hql.internal.ast.QuerySyntaxException: Website is not
    mapped</p>
  </blockquote>
  
  <p>.I have tried each solution to solve this error.Please review my code and let me know if there is any suggestion.Thank You</p>
  
  <p>GifController:</p>
  
  <pre><code>  package com.gif.code.controller;
  
    import java.util.List;
  
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.PathVariable;
    import org.springframework.web.bind.annotation.RequestBody;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RestController;
  
    import com.gif.code.model.GifModel;
    import com.gif.code.service.GifService;
  
    @RestController
    public class GifController {
  
      @Autowired
      GifService gifService;
  
      @RequestMapping(value = "/getAllData", method = RequestMethod.GET,  headers = "Accept=application/json")
      public List&lt;GifModel&gt; getData() {
          System.out.println("In Controller");
          List&lt;GifModel&gt; listOfData = gifService.getAllData();
          return listOfData;
      }
  
      @RequestMapping(value = "/getData/{id}", method = RequestMethod.GET, headers = "Accept=application/json")
      public GifModel getDataById(@PathVariable int id) {
          return gifService.getData(id);
      }
  
      @RequestMapping(value = "/addData", method = RequestMethod.POST, headers = "Accept=application/json")
      public void addData(@RequestBody GifModel gifModel) {   
          gifService.addData(gifModel);
  
      }
  
  }
  </code></pre>
  
  <p>GifModel:</p>
  
  <pre><code>    package com.gif.code.model;
  
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.GenerationType;
      import javax.persistence.Id;
      import javax.persistence.Table;
  
      @Entity
      @Table(name="WEBSITE")
      public class GifModel {
  
      @Id
      @Column(name="id")
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      int id;
  
      @Column(name="title")
      String title;   
  
      @Column(name="description")
      String description;
  
      public GifModel() {
          super();
      }
      public GifModel(int i, String title,String description) {
          super();
          this.id = i;
          this.title = title;
          this.description=description;
      }
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getTitle() {
          return title;
      }
      public void setTitle(String title) {
          this.title = title;
      }
      public String getDescription() {
          return description;
      }
      public void setDescription(String description) {
          this.description = description;
      }
  }
  </code></pre>
  
  <p>GifService:</p>
  
  <pre><code>    package com.gif.code.service;
  
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
  
  import com.gif.code.dao.GifDao;
  import com.gif.code.model.GifModel;
  
  @Service("gifService")
  public class GifService {
  
      @Autowired
      GifDao gifDao;
  
      @Transactional
      public List&lt;GifModel&gt; getAllData() {
          System.out.println("In Service");
          return gifDao.getAllData();
      }
  
      @Transactional
      public GifModel getData(int id) {
          return gifDao.getData(id);
      }
  
      @Transactional
      public void addData(GifModel gifmodel) {
          gifDao.addData(gifmodel);
      }
  
  }
  </code></pre>
  
  <p>GifDao:</p>
  
  <pre><code>package com.gif.code.dao;
  
  import java.util.List;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Repository;
  
  import com.gif.code.model.GifModel;
  
  @Repository
  public class GifDao {
  
      @Autowired
      private SessionFactory sessionFactory;
  
      public void setSessionFactory(SessionFactory sf) {
          this.sessionFactory = sf;
      }
  
      @SuppressWarnings("unchecked")
      public List&lt;GifModel&gt; getAllData() {
          System.out.println("In Dao");
          Session session = this.sessionFactory.getCurrentSession();
          List&lt;GifModel&gt; textList = session.createQuery("from Website").list();
          return textList;
      }
  
      public GifModel getData(int id) {
          Session session = this.sessionFactory.getCurrentSession();
          GifModel gifmodel = (GifModel) session.load(GifModel.class, new Integer(id));
          return gifmodel;
      }
  
      public GifModel addData(GifModel gifmodel) {
          Session session = this.sessionFactory.getCurrentSession();
          session.persist(gifmodel);
          return gifmodel;
      }
  
  }
  </code></pre>
  
  <p>Spring-servlet.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns="http://www.springframework.org/schema/mvc"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
      xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"&gt;
  
      &lt;annotation-driven /&gt;
  
      &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  
      &lt;beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close"&gt;
          &lt;beans:property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
          &lt;beans:property name="url"
              value="jdbc:mysql://localhost:3306/gifdata" /&gt;
          &lt;beans:property name="username" value="root" /&gt;
          &lt;beans:property name="password" value="Chirpn123" /&gt;
      &lt;/beans:bean&gt;
  
      &lt;!-- Hibernate 4 SessionFactory Bean definition --&gt;
      &lt;beans:bean id="hibernate4AnnotatedSessionFactory"
          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;beans:property name="dataSource" ref="dataSource" /&gt;
          &lt;beans:property name="annotatedClasses"&gt;
              &lt;beans:list&gt;
                  &lt;beans:value&gt;com.gif.code.model.GifModel&lt;/beans:value&gt;
              &lt;/beans:list&gt;
          &lt;/beans:property&gt;
          &lt;beans:property name="hibernateProperties"&gt;
              &lt;beans:props&gt;
                  &lt;beans:prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect
                  &lt;/beans:prop&gt;
                  &lt;beans:prop key="hibernate.show_sql"&gt;true&lt;/beans:prop&gt;
              &lt;/beans:props&gt;
          &lt;/beans:property&gt;
      &lt;/beans:bean&gt;
  
      &lt;context:component-scan base-package="com.gif.code" /&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
      &lt;beans:bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;beans:property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" /&gt;
      &lt;/beans:bean&gt;
  
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>Pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.gif.code&lt;/groupId&gt;
      &lt;artifactId&gt;Gif&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;Gif Maven Webapp&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;!-- &lt;dependency&gt;
           &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
             &lt;version&gt;3.1.0.RELEASE&lt;/version&gt;
          &lt;/dependency&gt; --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.4.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Hibernate --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Apache Commons DBCP --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Spring ORM --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- AspectJ --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.6&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;finalName&gt;Gif&lt;/finalName&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${jdk.version}&lt;/source&gt;
                      &lt;target&gt;${jdk.version}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
  
      &lt;/build&gt;
      &lt;properties&gt;
          &lt;spring.version&gt;4.2.1.RELEASE&lt;/spring.version&gt;
          &lt;security.version&gt;4.0.3.RELEASE&lt;/security.version&gt;
          &lt;jdk.version&gt;1.7&lt;/jdk.version&gt;
          &lt;hibernate.version&gt;4.3.5.Final&lt;/hibernate.version&gt;
          &lt;org.aspectj-version&gt;1.7.4&lt;/org.aspectj-version&gt;
      &lt;/properties&gt;
  &lt;/project&gt;
  </code></pre>