title: Springboot could not extract ResultSet
body: <p>Currently I am getting a problem with fetching mysql data for my springboot project:</p>
  
  <p>There was an unexpected error (type=Internal Server Error, status=500).
  could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet</p>
  
  <p><strong>TestEntity.java</strong></p>
  
  <pre><code>@Entity
  public class TestEntity implements Serializable {
  
      @Id
      private int id;
      private String p1;
      private String p2;
      private String p3;
  
      public TestEntity() {
      }
  
      public TestEntity(int id, String p1, String p2, String p3){
          this.id = id;
          this.p1 = p1;
          this.p2 = p2;
          this.p3 = p3;
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getP1() {
          return p1;
      }
  
      public void setP1(String p1) {
          this.p1 = p1;
      }
  
      public String getP2() {
          return p2;
      }
  
      public void setP2(String p2) {
          this.p2 = p2;
      }
  
      public String getP3() {
          return p3;
      }
  
      public void setP3(String p3) {
          this.p3 = p3;
      }
  
  
  
  }
  </code></pre>
  
  <p><strong>TestService.java</strong></p>
  
  <pre><code>@Service
  public class TestService {
  
      @Autowired
      private TestRepository testRepository;
  
      public ArrayList&lt;TestEntity&gt; getAllTestEntities(){
         ArrayList&lt;TestEntity&gt; list = new ArrayList();
         testRepository.findAll().forEach(list::add);
         return list;
      }
  
      public Optional getTestEntity(int id){
         return testRepository.findById(id);
      }
      public void addTestEntity(TestEntity t){
          testRepository.save(t);
      }
      public void removeTestEntity(int index){
  
          testRepository.deleteById(index);
  
      }
  
  }
  </code></pre>
  
  <p><strong>TestRepository.java</strong></p>
  
  <pre><code>@Repository("mysql")
  public interface TestRepository extends CrudRepository&lt;TestEntity,Integer&gt; {
  
  
  
  }
  </code></pre>
  
  <p><strong>TestController.java</strong></p>
  
  <pre><code>@RestController
  public class TestController {
  
      @Autowired
      private TestService testService;
  
      @RequestMapping("/test/AllUnits")
      public ArrayList&lt;TestEntity&gt; getAllTestUnits(){
          return testService.getAllTestEntities();
      }
  
      @RequestMapping("/test/{id}")
      public Optional getAllTestUnit(@PathVariable int id){
          return testService.getTestEntity(id);
      }
  
      @RequestMapping(method=RequestMethod.POST,value = "/test" )
      public void addTestUnit(@RequestBody TestEntity t){
          testService.addTestEntity(t);
      }
  
      @RequestMapping(method=RequestMethod.DELETE,value = "/test/{id}" )
      public void deleteTestUnit(@RequestBody Integer id){
          testService.removeTestEntity(id);
      }
  
      @RequestMapping("/test/welcome")
      public String welcome(){
  
          return "welcome to springboot";
  
      }
  
  
  }
  </code></pre>
  
  <p><strong>Edit</strong>: <strong>application.properties</strong></p>
  
  <pre><code>cloud.aws.region.auto=true
  cloud.aws.region.static=us-east-2
  
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.datasource.url=jdbc:mysql://alyxdev.czcdgqfkwsnr.us-east-2.rds.amazonaws.com:3306/CryptoCurrency
  spring.datasource.username=*******
  spring.datasource.password=*******
  </code></pre>
  
  <p>I am able to get the /test/welcome mapping working so I believe my implementation of the service and controller is correct. So I am wondering if I made a mistake for accessing my database in my repository or should I use a JpaRepository instead of a CrudRepository and use an explicit query?</p>
  
  <p><strong>Edit Stack Trace</strong>: 
  org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
  Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'CryptoCurrency.test_entity' doesn't exist</p>