Spring Boot, JPA and MySQL returns empty results
<p>Ok I'm new to Java Spring and I am simply trying to access some data from a MYSQL database. Unfortunately I can't seem to load any data - I'm sure it's a silly mistake. (I've followed a number of sources, including <a href="https://stackoverflow.com/questions/27981789/how-to-use-spring-boot-with-mysql-database-and-jpa">this one</a>)  </p>

<p><strong>I am using:</strong> java spring-boot, mysql, jpa, gradle</p>

<p>Here is my <code>build.gradle</code>: </p>

<pre><code>buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar {
    baseName = 'gs-serving-web-content'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")

    compile("com.h2database:h2") //I get embedded db error if I take this out
    testCompile("junit:junit")
    compile('mysql:mysql-connector-java:5.1.35')
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}
</code></pre>

<p>Controller: </p>

<pre><code>@Controller
public class PersonController {
    @Autowired
    private PersonRepository personRepository;

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
public String greeting(...){
    List&lt;Person&gt; allPeople = personRepository.findAll(); //this comes back with 0 values
    ...
}
</code></pre>

<p>PersonRepository: </p>

<pre><code>public interface PersonRepository extends JpaRepository&lt;Person, Long&gt; {
List&lt;Person&gt; findAll(); //returns empty list

//Person findByAge(int Age); //throws an exception if I leave this on: "...nested exception is java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract hello.model.Person hello.repository.PersonRepository.findByAge(int)!"
}
</code></pre>

<p>Person: </p>

<pre><code>@Entity
@Table(name="person")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long PersonID;
    private String Firstname;
    private String Lastname;
    private int Age;
    //getters and setters
}
</code></pre>

<p>Application.yaml</p>

<pre><code>spring:
 datasource:
  url: jdbc:mysql://localhost:3306/datatest
  username: root
  password: ***
  driverClassName: com.mysql.jdbc.Driver
</code></pre>

<p>I've connected intelliJ successfully to MySQL database (under database tab)
<a href="https://i.stack.imgur.com/778J1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/778J1.jpg" alt="enter image description here"></a>
and I can query it fine from the tab, but I can't load up the data through spring. There's got to be something wrong with my setup considering I can't seem to remove the embedded h2 database without an exception, nor can I add <code>findByAge</code>, <code>findByFirstname</code> etc combinations (all throw exceptions). </p>

<p><strong>Update 1:</strong> I've applied hd1's changes to the Person class but I'm still not getting any data back: </p>

<pre><code>@Entity
@Table(name="person")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long personID;
    private String firstName;
    private String lastName;
    private int age;
    //getters and setters updated
</code></pre>

<p>PersonRepository: </p>

<pre><code>List&lt;Person&gt; findAll();
Person findByAge(int age); //no more errors here, but returns null
Person findByLastName(String lastName);  //no more errors here, but returns null
</code></pre>

<p><a href="https://gist.github.com/gudthing/d29c377bd64cd639461f" rel="nofollow noreferrer">Full Runlog file</a> </p>

<p><strong>Update 2:</strong> the controller method: </p>

<pre><code>@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String greeting(@RequestParam(value = "name", required = false, defaultValue = "world") String name, Model model) {
    List&lt;Person&gt; allPeople = personRepository.findAll();
        ...
    System.out.print(allPeople.size()); //always 0, but I have many entries in db

    //if I try to create and save new entry in the db: 
    Person person = new Person();
    person.setFirstName("New");
    person.setLastName("Person");
    person.setAge(99);
    personRepository.save(person); //does not show up in DB, why?
    return "greeting";
}
</code></pre>