title: Can not Fetch Data with JPQL using Postgres Database Spring MVC
body: <p>I am trying to develop SpringMVC framework, everything working fine but when I run my codes, data are not fetched from Postgres database using JPQL.</p>
  
  <p><strong><em>domain model class</em></strong></p>
  
  <pre><code>    import java.io.Serializable;
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.GenerationType;
      import javax.persistence.Id;
      import javax.persistence.NamedQueries;
      import javax.persistence.NamedQuery;
      import javax.persistence.Table;
      import javax.persistence.Version;
  
      @Entity
      @Table(name = "Contact")
      @NamedQueries({ 
      @NamedQuery(name="Contact.findAll", query="select c from Contact c")
      })
  
      public class Contact implements Serializable {
  
          private Long id;
          private int version;
          private String firstName;
          private String lastName;
          private String description;
  getter and setter defined
  </code></pre>
  
  <p><strong><em>Repository Class</em></strong></p>
  
  <pre><code>import java.util.List;
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import org.springframework.stereotype.Repository;
  import org.springframework.transaction.annotation.Transactional;
  import com.apress.prospring3.ch17.domain.Contact;
  @Repository
  @Transactional
  public class ContactRepository implements CrudRepository {
      @PersistenceContext
      private EntityManager manager;
  
      public List&lt;Contact&gt; findAll() {
          List&lt;Contact&gt; contact = manager.createNamedQuery("Contact.findAll", 
                  Contact.class).getResultList();
          return contact;
      }
  }
  </code></pre>
  
  <p><strong><em>Controller Class</em></strong></p>
  
  <pre><code>import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import com.apress.prospring3.ch17.domain.Contact;
  import com.apress.prospring3.ch17.service.ContactService;
  
  @RequestMapping("/contact")
  @Controller
  public class ContactController {
  
      @Autowired
      ContactService contactService;
  
      @RequestMapping(method = RequestMethod.GET)
      public String list(Model uiModel) {
          List&lt;Contact&gt; contacts = contactService.findAll();
          uiModel.addAttribute("contacts", contacts);
          return "contacts/list";
  
      }
  }
  </code></pre>
  
  <p><strong><em>Front View (list.jspx)</em></strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;div xmlns:jsp="http://java.sun.com/JSP/Page"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:joda="http://www.joda.org/joda/time/tags" version="2.0"&gt;
      &lt;jsp:directive.page contentType="text/html;charset=UTF-8" /&gt;
      &lt;jsp:output omit-xml-declaration="yes" /&gt;
      &lt;h1&gt;Contact Listing&lt;/h1&gt;
          &lt;table&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;First Name&lt;/th&gt;
                      &lt;th&gt;Last Name&lt;/th&gt;
                      &lt;th&gt;Birth Date&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;c:forEach items="${contacts}" var="contact"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;${contact.firstName}&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/c:forEach&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong><em>Server Logs</em></strong></p>
  
  <blockquote>
    <p>Hibernate: select contact0_.ID as ID1_0_, contact0_.DESCRIPTION as
    DESCRIPT2_0_, contact0_.FIRST_NAME as FIRST_NA3_0_,
    contact0_.LAST_NAME as LAST_NAM4_0_, contact0_.VERSION as VERSION5_0_
    from Contact contact0_</p>
    
    <p>Jan 24, 2016 2:19:14 PM org.apache.jasper.compiler.TldLocationsCache
    tldScanJar INFO: At least one JAR was scanned for TLDs yet contained
    no TLDs. Enable debug logging for this logger for a complete list of
    JARs that were scanned where no TLDs were found. Skipping JAR scanning
    can improve startup time and JSP compilation time.</p>
  </blockquote>
  
  <p><strong><em>Output</em></strong></p>
  
  <p><a href="https://i.stack.imgur.com/kwgMc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kwgMc.jpg" alt="enter image description here"></a></p>
  
  <p><strong><em>Postgres DataBase data</em></strong>
  <a href="https://i.stack.imgur.com/RpStr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RpStr.jpg" alt="enter image description here"></a></p>
  
  <p><strong>Please correct me what I am missing.
  Thank you so much.</strong></p>